furniturepeople
asked on
Tough Challenge: Can you automatically select only the files in a directory whose filenames appear in a spreadsheet?
Let's say you have a column of file names in a spreadsheet (ie - 12F.jpg, 12G.jpg, 27H.jpg, etc)
You also have a folder full of files. Some of the files match the ones in your spreadsheet (ie - 12F.jpg, 12G.jpg, 27H.jpg). However, some of the files in the folder do not match the ones in your spreadsheet.
Is there an way to automatically select only the jpg files that are in the spreadsheet? That way you can make a copy of only those files for instance.
Thanks so much in advance.
You also have a folder full of files. Some of the files match the ones in your spreadsheet (ie - 12F.jpg, 12G.jpg, 27H.jpg). However, some of the files in the folder do not match the ones in your spreadsheet.
Is there an way to automatically select only the jpg files that are in the spreadsheet? That way you can make a copy of only those files for instance.
Thanks so much in advance.
ASKER
Thanks, Is there a way to do it without VBA? I don't know how to use VBA.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I've requested that this question be deleted for the following reason:
Not enough information to confirm an answer.
Not enough information to confirm an answer.
There is definitely enough information to confirm an answer. I tested the solution proposed in http:#a39730202 – it works perfectly. I used the technique to copy all of the file names in column A of a spreadsheet to a text file (.BAT) in my favorite editor. I then used a macro to automatically prefix each file name with "copy" and suffix each file name with "D:\saved_files". I then ran the batch file – worked fine. If the OP (or CV) needs more info, please let me know. Regards, Joe
Netminder,
Thank you! Regards, Joe
Thank you! Regards, Joe
Loop through all the files listed and copy them to the desired destination.
Use an On Error statement to ignore the copy command if the file is not present.