# Save/Export Search Results

### Question

• Good day everyone,

So the other day I used the Windows 7 version of Windows Search to find all files of specific file type in a networked drive, so that we can remove the extraneous ones.  The issue with it is I would like to take the results of the search and turn it into a "Checklist" of sorts.

Is there anyway to print/export/save the results of a search?  I already "Saved" the search, but that's really only helpful to me for re-running the search in the future.
Ideally, I would like to be able to save/export it as a TXT or CSV file with the currently viewed columns.

Is there a way to do this, be it through the GUI or command line?

-Paul
Thursday, February 04, 2010 3:00 PM

• Try a different search program like Agent Ransack ? Perhaps it has the capability to save the results to a file? It has a File / Save as so may work for you.

I don't know if it works on Windows 7 but it's worth a shot. If not, there are others available that a Google search should find.
Rich
• Marked as answer by Friday, February 05, 2010 2:32 PM
Friday, February 05, 2010 4:39 AM

### All replies

• Hello Paul,

I have faced this problem before, and this is how i ended up getting that list:

1 - Open Windows Explorer and search for what you want
2 - When the search results populate, select all (Ctrl + A)
3 - Hold the Shift key and Right Click on the search results
4 - Select "Copy as Path" (this option only shows up when you hold shift before the right click)
5 - Paste into a notepad window, Excel spreadsheet, etc...

The results will be formatted as:
"\path\to\first\item"
"\path\to\second\item"
...

Hope this helps.
Tarek
• Proposed as answer by Thursday, February 04, 2010 7:46 PM
• Unproposed as answer by Friday, February 05, 2010 2:32 PM
• Proposed as answer by Tuesday, April 27, 2010 7:38 AM
Thursday, February 04, 2010 7:45 PM
• Hi Tarek,
I tried that yesterday, and while it does allow me to copy the results to an external source, all I get is the path\file.  I was hoping to find a way to get the results with the current Detail view (file name, date created, date modified, size, etc).

Any other suggestions?

Thanks again!

-Paul
Thursday, February 04, 2010 7:54 PM
• Its pretty coarse, but you could try screenshotting and OCR. If you have OneNote then try this.

2)Use the OneNote screen clip to copy a single column
3)Do the same thing for the next column, making sure the first and last entries are the same.
4)Repeat for all your columns
5)Copy text from the first clip
6)Paste into the first column in Excel
7)Repeat for the following columns

I just tested it and it works in the 2010 Beta. I'm sure it would work with 07 as well. If you have many pages of files it might get to be redundant, but its the only thing I can think of. Just make sure it all lines up so you dont get an off-by-one error.

Unfortunately OCR doesnt handle columns very well, so doing more than one at a time messes it all up.
Thursday, February 04, 2010 8:29 PM
• Hmmm...Interesting.  The unfortunate thing is that I have 880 items in my results.  I'd only be able to screenshot 46 at a time.  :(

Any other thoughts?  Can the Windows Search functionality be leveraged from the Command Line or PowerShell?
Thursday, February 04, 2010 8:41 PM
• no clue. sorry
Thursday, February 04, 2010 9:17 PM
• Try a different search program like Agent Ransack ? Perhaps it has the capability to save the results to a file? It has a File / Save as so may work for you.

I don't know if it works on Windows 7 but it's worth a shot. If not, there are others available that a Google search should find.
Rich
• Marked as answer by Friday, February 05, 2010 2:32 PM
Friday, February 05, 2010 4:39 AM
• I just tried it and it works well. I searched for all .doc files under C:\Users, here are a few (edited) results:

C:\users\xxxxxxx\Documents\xxxxxxx\TALK FOR MISSION.doc   (22 KB,  3/28/2001 6:13:44 PM)
C:\users\xxxxxxx\My Documents\xxxxxxx\TALK FOR MISSION.doc   (22 KB,  3/28/2001 6:13:44 PM)
C:\users\xxxxxxx\Documents\fla_trip.doc   (21 KB,  4/1/2001 5:55:44 PM)
C:\users\xxxxxxx\My Documents\fla_trip.doc   (21 KB,  4/1/2001 5:55:44 PM)
C:\users\xxxxxxx\Documents\crownvic.doc   (5 KB,  5/7/2001 8:55:42 PM)
C:\users\xxxxxxx\My Documents\crownvic.doc   (5 KB,  5/7/2001 8:55:42 PM)

Rich
Friday, February 05, 2010 4:56 AM
• Hi Tarek,
I tried that yesterday, and while it does allow me to copy the results to an external source, all I get is the path\file.  I was hoping to find a way to get the results with the current Detail view (file name, date created, date modified, size, etc).

Any other suggestions?

Thanks again!

-Paul

This article was written for Windows XP, but should apply to Windows 7 also.

How to print Windows XP Search results to a file ?:
http://windowsxp.mvps.org/searchresults.htm

(Using Nirsoft's SysExporter)
Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]
Friday, February 05, 2010 6:53 AM
• Agent Ransack it is!
I'm missing out on the "Date Created", but this will work alright.

Thanks Rich!
Friday, February 05, 2010 2:30 PM
• Hi Ramesh,

I really, really wanted SysExporter to work, but it doesn't work properly with Windows 7.  As a matter of fact, right under the download link on their page it says "Notice for Windows 7 users!  Starting from Windows 7, Microsoft changed the control that is used for displaying files and folder in Explorer window, and thus SysExporter cannot grab the data from Explorer windows on Windows 7. "

Damn...
Friday, February 05, 2010 2:32 PM
• Hi Ramesh,

I really, really wanted SysExporter to work, but it doesn't work properly with Windows 7.  As a matter of fact, right under the download link on their page it says "Notice for Windows 7 users!  Starting from Windows 7, Microsoft changed the control that is used for displaying files and folder in Explorer window, and thus SysExporter cannot grab the data from Explorer windows on Windows 7. "

Damn...

Whoops! Did not know that, Paul.
Thanks for the update.
Ramesh Srinivasan, Microsoft MVP [Windows Desktop Experience]
Friday, February 05, 2010 2:58 PM
• Is there really no way to export the search results natively?
Tyler McLaughlin
Friday, March 05, 2010 5:15 AM
• One approach if you want more than just the path/filename (using the shift-rightclick "copy as path" noted above) would be to drag a *copy* of the files identified by the search results, to a temporary folder and then access the contents of that temp folder using a program like "Printfolder" which can generate a text file containing optionally selected info such as file name, size, etc

Thursday, February 16, 2012 12:36 AM
• Thank you! That worked perfectly! :)﻿﻿

Robert Bolton

Thursday, August 09, 2012 2:37 PM
• This one thing I have been wanting since Windows 3.1 ! Microsft NEEDS to add this to there list of things to have. I have often enough needed to work with a list of files discovered in a search, but need it as a static list to work with. I cannot use a saved search, because the list would change as I work with the files. I NEED THE SEARCH RESULTS PRINTED OR SAVED TO A MEMO OR TEXT FILE.

I hope I am succesful for now in utilizing the suggestions here, but I really hope Microsoft will open their eyes to the need and usefullness of such an ability in their OS.

Friday, September 07, 2012 1:50 PM
• Hi

this was very helpful thanks!

there is another old school method i was using (before i read this thread!) which might be useful

• open a DOS command prompt,
• navigate to the folder,
• use the comand "dir >dir.txt" to output to a text file which will include file sizes, dates etc...

the syntax is still not ideal for sorting the txt in excel, but you can add switches to the dos command to filter & sort the results which helps a little bit

thanks again all,

• Edited by Wednesday, October 10, 2012 3:58 PM
• Proposed as answer by Tuesday, November 12, 2013 3:23 PM
Wednesday, October 10, 2012 3:50 PM
• Tarek,

I used this today and it worked excellently!  What a great little tip.

Thanks a lot.

Tim

Wednesday, January 09, 2013 2:30 PM
• yes i thank you also for the "hold the Shift key and right click the search results to capture the "path", great have a great year!

Friday, July 05, 2013 3:14 PM
• another way would  be to create a shortcut of every result, select all results, right click and drag on an empty folder, select 'create shortcuts here', now the folder has a shortcut of every result and it's easy to access. every shortcut is 15kb.
Monday, May 12, 2014 5:41 PM
• This works! Although a bit slow, data can be used in databases and Excel. Great.
Friday, December 19, 2014 10:29 AM
• Thank you it was very helpfull
Sunday, January 25, 2015 5:57 PM
• This worked - thank you.
Monday, August 03, 2015 12:33 PM
• 4 - Select "Copy as Path" (this option only shows up when you hold shift before the right click)
That was VERY helpful for me! Thank you!
Wednesday, December 23, 2015 8:32 AM
• I tried to use OCR but because of the small number of pixels per character it will not reliably convert to text.  There are just too many errors to be useful.  I tried this on two different OCR programs.  The other comment about too few lines to be useful is well noted and I agree this will work in limited cases.

Saturday, January 23, 2016 10:53 PM
• I use the "select all" and "copy as path" as suggested by others.

THEN... paste it in Excel and run a VBA script to loop through each result to display any file attribute you want (at least any attribute available through the FileSystemObject).

Requires a little coding but works like a charm.

Here are the basics of the steps and code.

1. First go to a blank worksheet in Excel and name the column for cell A1 as "Files" (or whatever).

2. Then use the "select all" and "copy as path" method to copy your results in cell A2.

3. Make sure, in VBA, you have a library reference to "Microsoft Scripting Runtime" (go to the VBA Editor and then the menu "Tools > References" to add the reference). This allows access to the "FileSystemObject" which you'll be using to get the attributes.

4. Then apply following script (adjust as you want).

Private Sub ListFileAttributes()
Dim FSO As Scripting.FileSystemObject
Dim iRow As Integer, iCol As Integer, LastRow As Integer

Set FSO = New Scripting.FileSystemObject

iCol = 2

Range(Cells(1, iCol), Cells(1, iCol + 13)).EntireColumn.Clear

iRow = 1
Cells(iRow, iCol + 1) = "Name"
Cells(iRow, iCol + 2) = "Folder"
Cells(iRow, iCol + 3) = "Type"
Cells(iRow, iCol + 4) = "Size"
Cells(iRow, iCol + 5) = "DateCreated"
Cells(iRow, iCol + 6) = "DateLastModified"
Cells(iRow, iCol + 7) = "DateLastAccessed"
Cells(iRow, iCol + 8) = "Attributes"
Cells(iRow, iCol + 9) = "Drive"
Cells(iRow, iCol + 10) = "ParentFolder"
Cells(iRow, iCol + 11) = "Path"
Cells(iRow, iCol + 12) = "ShortName"
Cells(iRow, iCol + 13) = "ShortPath"

LastRow = Cells(Rows.Count, 1).End(xlUp).Row

For iRow = 2 To LastRow
Set FileItem = FSO.GetFile(Cells(iRow, 1))

Cells(iRow, iCol + 1) = FileItem.Name
Cells(iRow, iCol + 2) = Replace(FileItem.Path, FileItem.Name, "")
Cells(iRow, iCol + 3) = FileItem.Type
Cells(iRow, iCol + 4) = FileItem.Size
Cells(iRow, iCol + 5) = FileItem.DateCreated
Cells(iRow, iCol + 6) = FileItem.DateLastModified
Cells(iRow, iCol + 7) = FileItem.DateLastAccessed
Cells(iRow, iCol + 8) = FileItem.Attributes
Cells(iRow, iCol + 9) = FileItem.Drive
Cells(iRow, iCol + 10) = FileItem.ParentFolder
Cells(iRow, iCol + 11) = FileItem.Path
Cells(iRow, iCol + 12) = FileItem.ShortName
Cells(iRow, iCol + 13) = FileItem.ShortPath
Next

Range(Cells(1, iCol), Cells(1, iCol + 13)).EntireColumn.AutoFit

Set FileItem = Nothing
Set FSO = Nothing
End Sub


Saturday, June 11, 2016 3:32 PM
• Not the best solution, but it works and only uses standard windows command line tools.

First, use Tarek's "Copy as Path" solution and paste the results into a text file.

Then use the built-in "for" command to regenerate the missing details.  For example:

for /F "delims=;" %p in (myFiles.txt) do @echo "%~nxp",%~tp,%~zp,"%~pp">>myFiles.csv

will generate csv output in myFiles.csv (sorry - no "Type" column)

The cryptic characters mean:

%nxp - filename and extension

%~tp - timestamp

%~zp - file size, in bytes

%~pp - file path

for more options, type for /? at the command prompt.

Wednesday, June 22, 2016 8:00 PM
• I've been wanting to figure this out for a long time and finally found a good solution (works in windows 10 and presumably all versions prior)

I got this from Robb1112's answer in another thread

• Get this freeware program called SysExporter: http://www.nirsoft.net/utils/sysexp.html
• You don't need to install it, just run it
• Have your windows search window ready in the details view with whatever columns you want
• Drag the target/bullseye icon from SysExporter to the search window
• In SysExporter click File > Export All Items
• Save as txt, csv, xml, html, etc
Friday, August 19, 2016 4:48 PM
• Thanks mate, pretty easy and time saving solution
Saturday, August 27, 2016 3:03 AM
• Thanks Tarek!  That was exactly what I needed.  This does not happen often.  A perfect fit.  I signed up just to let you know.
Thursday, December 14, 2017 5:51 AM