ITMcmcpa
asked on
Move files based on an Excel list
I have a repetitive task each month to move files from one location to another based on the file name. In this case, we have a PDF file that has a name of a person. Example: Doe, John (1234).pdf
I would like to create an Excel list that has two columns. The first column would have the name of the destination folder and the second column would have the name of the file. The name of the file never changes, only the content of the file for that user. There are about 200 files that will be moved during each session.
Column A = Folder name- JohnD
Column B = File name- Doe, John (1234).pdf
I would like to find a script that will loop through each file in the origin folder
Get the file name
Lookup the file name in the Excel list
If the file name is found, get the destination path/folder from the matching column
Move the found file to the destination folder
Overwrite the file in the destination if it exists
Delete the original file
Any suggestions?
I would like to create an Excel list that has two columns. The first column would have the name of the destination folder and the second column would have the name of the file. The name of the file never changes, only the content of the file for that user. There are about 200 files that will be moved during each session.
Column A = Folder name- JohnD
Column B = File name- Doe, John (1234).pdf
I would like to find a script that will loop through each file in the origin folder
Get the file name
Lookup the file name in the Excel list
If the file name is found, get the destination path/folder from the matching column
Move the found file to the destination folder
Overwrite the file in the destination if it exists
Delete the original file
Any suggestions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
oFS.DeleteFile ("C:\sourcepath\" & file.name)
Thanks again!