Solved

Tough Challenge: Can you automatically select only the files in a directory whose filenames appear in a spreadsheet?

Posted on 2013-12-19
8
169 Views
Last Modified: 2014-01-31
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
Comment
Question by:furniturepeople
8 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39730169
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
 

Author Comment

by:furniturepeople
ID: 39730184
Thanks, Is there a way to do it without VBA?  I don't know how to use VBA.
0
 
LVL 52

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
ID: 39730202
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 59

Expert Comment

by:LeeTutor
ID: 39771359
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 
LVL 52

Expert Comment

by:Joe Winograd, EE MVE
ID: 39771360
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
 
LVL 52

Expert Comment

by:Joe Winograd, EE MVE
ID: 39825871
Netminder,
Thank you! Regards, Joe
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question