Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 55

Accepted Solution

by:
Joe Winograd, EE MVE 2015&2016 earned 2000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
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 55

Expert Comment

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

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

688 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