You are here:

Excel/Searching for files from Excel sheet


Hi Aiden,
You've helped me before and I trust you.

I am working on a project that I feel could probably be done much quicker than I am doing it, probably with a DOS command. Please note, I am good within software but not so much with systems.  

I have an excel spreadsheet with a list of over 3700 part numbers. I also have an external hard drive with multiple folders that have photographs of these parts.  I need to find the photos for each of these part numbers and move them to another folder. The photos are named with the part number and additional information if there are multiples. Example 10282710.jpg, 10282710-1Primary.jpg, 10282710-1Alternate.jpg.  

I am currently doing a quick search with the number 10282710 on the search within the main folder, then dragging the photos to a folder on my desktop.

Please note, there may also be photos called 22-10282710.jpg, which I do not want.

Is there a quicker way to do this other than searching for photos one at a time?


Excel prior to version 2007 can use the FileSystemObject - which means you can use VBA to do a search for files - which could be written to then copy files to a folder.  Since 2007, this very useful feature has been removed, and I've not found a suitable alternative (yet!).  It would certainly be possible to run a series of searches via DOS - though POSSIBLY the quickest way would be to do a DIR listing for all jpg files - from memory, dir *.jpg /s >c:\temp\JPG_Files.text would be the style of command line to run - this would creat a text file which could then be opened in excel and "stitched" together such that you get the file name in one column and the location in another - you could then use the search function (perhaps) to get the matches?

More than happy to help further in any way I can
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Aidan Heritage


I have provided first hand support since `95 for Microsoft Office majoring in Word and Excel - support for all versions from 2 onwards. I'm based in the UK, so please allow for time differences when asking me questions from other parts of the world! As AllExperts closes down, just google me to find my details - I will still be around answering questions!


My background is in the insurance industry and call centre areas, but have been called upon to provide many varied solutions.

I'm educated to UK A level standard, but as I left school some 30 years ago that is rather irrelevent - university of life has provided more of a background!

©2017 All rights reserved.

[an error occurred while processing this directive]