• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

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.
0
furniturepeople
Asked:
furniturepeople
1 Solution
 
Saqib Husain, SyedEngineerCommented:
One way to do this is to do the copy with the help of VBA.

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.
0
 
furniturepeopleAuthor Commented:
Thanks, Is there a way to do it without VBA?  I don't know how to use VBA.
0
 
Joe Winograd, Fellow&MVEDeveloperCommented:
You could highlight the whole column, copy it to the clipboard (Ctrl-C), then paste it (Ctrl-V) into a text file using whatever text editor you prefer, such as Notepad, Notepad++, Metapad, whatever. Once the file names are in a text file, you can manipulate them however you want, such as prefixing each file name with "copy" and suffixing each one with "D:\saved_files". Regards, Joe
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
LeeTutorretiredCommented:
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
Joe Winograd, Fellow&MVEDeveloperCommented:
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
0
 
Joe Winograd, Fellow&MVEDeveloperCommented:
Netminder,
Thank you! Regards, Joe
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now