Is there a way to dump the results of a file search in Windows 7 into a text file or spreadsheet?
March 28, 2012 2:06 PM   Subscribe

Is there a way to dump the results of a file search in Windows 7 into a text file or spreadsheet?

Hey everyone! I've recently been tasked with making a list of all image files on my organization's (large) server, and the list must include filenames and path information. Obviously it's very easy to search the server (from my Windows 7 machine) for files based on their extensions, but once I have the results in the explorer window, I need a way to easily get the names & paths into an Excel spreadsheet.

I'm open to any tips regarding apps, utilities or simple scripts that would make this process easier. Please don't hesitate to ask follow-up questions, and thanks in advance!
posted by chudmonkey to Computers & Internet (9 answers total) 6 users marked this as a favorite
 
Best answer: Use the command prompt. Navigate to the root of where you want to search and

dir /s /B *.ext1, *.ext2, *.ext3 > outputpath\images.txt

This will recursively search all subfolders for all files ending in .ext1, .ext2, and .ext3 and puts the filenames (with the full path) in the subfolder outputpath\images.txt
posted by Green With You at 2:12 PM on March 28, 2012 [3 favorites]


One thing you could do is install the Cygwin tools (which may be overkill but I install it on all my machines)

and run the following command from the drive / directory you want to collect info for.

c:\cygwin\bin\find . -name "*" -type f > allfiles.txt


This will give you a file listing containing the paths the files live in.
posted by bottlebrushtree at 2:14 PM on March 28, 2012


If you want the results to be in a form you you can easily get into excel, make the output filename 'images.csv'.
posted by Green With You at 2:15 PM on March 28, 2012


From the command line in windows it's easy. You just send the output to a text file.

Use the DIR command with the /b and /s switches. /b for bare format, no headers, /s for recursive.

eg. dir /b /s *.exe > resultsfilename.txt

You can play around with the switches for CMD to see what works. The key part is the arrow >.
posted by snarkle at 2:16 PM on March 28, 2012


Useful File Utilities is a GUI solution to this.
posted by Brent Parker at 2:50 PM on March 28, 2012


If you just want to copy the list from an explorer search window, select the files and hold the shift key while right clicking on one of them then choose "copy as path" - then you can paste this straight into excel. This might be impractical with thousands of files, so the techniques above might be better.
posted by samj at 2:53 PM on March 28, 2012 [4 favorites]


Useful File Utilities is a GUI solution to this.


FYI - my antivirus is screaming all sorts of warnings about this download. Be careful.
posted by lampshade at 3:12 PM on March 28, 2012


This is a pretty easy job in Powershell, which is included in Windows 7:

Get-ChildItem -Recurse -Include "*.jpg","*.cr2" \\behemoth-mini\photos | Select-Object -Property Name,Directory | Export-Csv C:\Users\pliu\Desktop\stuff.csv -NoTypeInformation

This will output a nice clean CSV file which you can then molest in Excel. Here I am running against the "Photos" share of my file server and saving to my local desktop. Note that you can just put the UNC path for your share, you don't need a mapped drive.

You can change the parameters on Get-ChildItem and Select-Object to get more or less information as required. If you need to sort, pipe to Sort-Object.
posted by tracert at 3:29 PM on March 28, 2012 [3 favorites]


samj: Wow, I had no idea that you get secret options by shift-right clicking. Why aren't those always there?!?

Anyway I just tried it with 25000 files. Explorer used all of a core for 4 minutes (with the "working" cursor), and 1.7GB of RAM, but it eventually worked fine (and excel has no problems with it). So I vote for your solution as the easiest one.
posted by aubilenon at 3:56 PM on March 28, 2012


« Older Way too much thinking about backpack morality   |   The art film version of Office Space? Newer »
This thread is closed to new comments.