We are receiving files with a specific naming convention and I am looking to create a script to move them from the SFTP folder to individual case folders which already have a specific naming convention. The file and the folder have the same policynumber in their names.
The file name is always going to be in this format: lastnamefirstname_providername_pgs_systemID_policynumber.pdf
The folders are always in the following format and these are preexisting, they do not need to be created: lastname, first name_policynumber
I want to be able to move the files into the corresponding folders and run this every night.
Any help is much appreciated.