help me search for many files on my HD at once?
October 13, 2011 12:04 PM   Subscribe

help me search my HD for about 600 files all at once.

I have an xls with about 600 filenames of the form AB-1234.pdf (except there is no extension. so really, they're not file names, but in my system, they are document codes on which the filename is based).

The files to which these strings refer are scattered on my hard drive. I need to collect them all in a single folder, and that folder can have no other files in it, other than those referenced on the xls.

If it were one file, I would use Windows search, using the AB-1234 as the search term. But it's 600 files. How to do this? Windows xp.
posted by stupidsexyFlanders to Computers & Internet (11 answers total) 4 users marked this as a favorite
 
To be sure that i'm understanding you correctly, you've got 600 different file names in an excel sheet (but without extensions), and files with those names are located somewhere on your hard drive (with extensions)?

Do these 600 filenames follow any specific pattern that we could potentially match? I'm not coming up with a good Windows search tool that accepts many inputs (this would be easy to do on Unix, but I digress).
posted by schmod at 12:11 PM on October 13, 2011


Download and install xPlorer2. It allows fast, sophisticated searches for files.

I just searched my ~100GB HD for all files matching ??-????.* and found 29 items. Examples:
zh-dayi.xml
zh-Hans.qm
bg-desk.png
(etc.)

It took about a minute. Changing this search to ??-????.pdf would obviously restrict your search better, but I wanted to make sure it would find matches first.

I tried this in Windows Explorer. It returned shitloads of files, NOT of form ??-????.* (basically, it returned every file containing a dash in its name).
posted by IAmBroom at 12:29 PM on October 13, 2011


AFTER you find them (they will pop up in a new search results window), press Alt+C. This will copy the results (with the entire path names) into your clipboard. You then have a text file containing all the files and their locations.
posted by IAmBroom at 12:30 PM on October 13, 2011


You want forfiles. Use your xls and add a column next to your list of filenames. Assuming that list is in column A and the files are all on c:\, enter into cell B1:

=CONCATENATE("forfiles /p c:\ /m ",A1," /s /c ""cmd /c copy @file c:\destinationfolder\""")

Copy this to all the other cells in the B column. Copy and paste the contents of B into a batch file. Execute. There may be a nicer way to do this, but this is how I'd roll with it.
posted by bfranklin at 1:00 PM on October 13, 2011 [1 favorite]


I was going to suggest writing a macro that loops through each cell in your column of filenames. Use the FileSearch object to find each file. Then probably use the FileSystemObject to move each file into the single folder. I think it would be a pretty short macro, but it might take some fussing around to get it to work properly. bfranklin's solution looks pretty compact and ready-to-go.
posted by polecat at 2:56 PM on October 13, 2011


cmd.exe: Assume codes.txt contains the ~600 codes.

dir /s/b *.pdf | findstr /g:codes.txt > files.txt
for /f %i in (files.txt) do copy %i c:\somedirectory

You'd check files.txt to make sure it has only the files you want.
posted by Monday, stony Monday at 4:02 PM on October 13, 2011


Response by poster: bfranklin, I tried your solution and the command prompt window response listed the files and folders in my c: root 600 times, once for each line in the bat file. c:/destinationfolder was empty.

Monday, stony -- I tried yours and checking "files.txt", it was empty every time. Also, they are not all *.pdf, so I tried *.* which didn't work, so I tried *.pdf and nothing with that either.

trying xPlorer2 now.

Thanks for trying, everybody.
posted by stupidsexyFlanders at 8:42 AM on October 17, 2011


Sorry, I didn't specify, but the codes need to be one per line in codes.txt for it to work.
posted by Monday, stony Monday at 9:27 AM on October 17, 2011


(And *.* should work just as well as *.pdf, it just makes the likelihood of false positives a bit higher)
posted by Monday, stony Monday at 9:28 AM on October 17, 2011


Best answer: They were, Monday.

For anyone who's got this problem, it turns out you can just enter multiple search terms into the windows search tool, comma separated.

I copied the codes out of the excel, pasted into notebook and then word, copy/replaced the paragraph marks with commas, and copy/pasted the whole thing into the windows search box. Search results gave me all the files. Appreciate the help though!
posted by stupidsexyFlanders at 11:05 AM on October 17, 2011


it turns out you can just enter multiple search terms into the windows search tool, comma separated.

Thanks!
posted by IAmBroom at 9:42 AM on October 18, 2011


« Older Where can I rent shop space in Portland OR?   |   Sticker shock Newer »
This thread is closed to new comments.