# Save/Export Search Results

• ### Soru

• 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
4 Şubat 2010 Perşembe 15:00

### Yanıtlar

• 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
5 Şubat 2010 Cuma 04:39

### Tüm Yanıtlar

• 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)

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

Hope this helps.
Tarek
• Yanıt Olarak Öneren 4 Şubat 2010 Perşembe 19:46
• Yanıt Önerisini Geri Alan 5 Şubat 2010 Cuma 14:32
• Yanıt Olarak Öneren 27 Nisan 2010 Salı 07:38
4 Şubat 2010 Perşembe 19:45
• 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
4 Şubat 2010 Perşembe 19:54
• 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.
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.
4 Şubat 2010 Perşembe 20:29
• 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?
4 Şubat 2010 Perşembe 20:41
• no clue. sorry
4 Şubat 2010 Perşembe 21:17
• 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
5 Şubat 2010 Cuma 04:39
• 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
5 Şubat 2010 Cuma 04:56
• 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]
5 Şubat 2010 Cuma 06:53
• Agent Ransack it is!
I'm missing out on the "Date Created", but this will work alright.

Thanks Rich!
5 Şubat 2010 Cuma 14:30
• 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...
5 Şubat 2010 Cuma 14:32
• 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]
5 Şubat 2010 Cuma 14:58
• Is there really no way to export the search results natively?
Tyler McLaughlin
5 Mart 2010 Cuma 05:15
• 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

16 Şubat 2012 Perşembe 00:36
• Thank you! That worked perfectly! :)﻿﻿

Robert Bolton

9 Ağustos 2012 Perşembe 14:37
• 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.

7 Eylül 2012 Cuma 13:50
• Hi

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,

• Düzenleyen 10 Ekim 2012 Çarşamba 15:58
• Yanıt Olarak Öneren 12 Kasım 2013 Salı 15:23
10 Ekim 2012 Çarşamba 15:50
• Tarek,

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

Thanks a lot.

Tim

9 Ocak 2013 Çarşamba 14:30
• 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!

5 Temmuz 2013 Cuma 15:14
• 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.
12 Mayıs 2014 Pazartesi 17:41
• This works! Although a bit slow, data can be used in databases and Excel. Great.
19 Aralık 2014 Cuma 10:29
• Thank you it was very helpfull
25 Ocak 2015 Pazar 17:57
• This worked - thank you.
3 Ağustos 2015 Pazartesi 12:33
• 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!
23 Aralık 2015 Çarşamba 08:32
• 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.

23 Ocak 2016 Cumartesi 22:53
• 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


11 Haziran 2016 Cumartesi 15:32
• 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.

• Yanıt Olarak Öneren 12 Ekim 2019 Cumartesi 01:24
22 Haziran 2016 Çarşamba 20:00
• 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)

• 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
19 Ağustos 2016 Cuma 16:48
• Thanks mate, pretty easy and time saving solution
27 Ağustos 2016 Cumartesi 03:03
• Thanks Tarek!  That was exactly what I needed.  This does not happen often.  A perfect fit.  I signed up just to let you know.
14 Aralık 2017 Perşembe 05:51
• Really awesome! Great job bro!

Work like a charm! Truly appreciated man!

2 Kasım 2018 Cuma 17:03
• Thanks Tarek, it work for me in Windows 10
18 Kasım 2018 Pazar 18:37
• I had a similar problem, wanting to compare a new machine drive contents to the old one I'd copied them from, as the file counts were different. I initially found and installed a copy of Xtree Gold to try to compare, but being a DOS program it wasn't happy with the new long filenames.

In the end I bit the bullet and learned how to use Powershell to do wildcard searches and compares. I can't remember the commands now but it is a powerful tool.

Pity MS didn't think to provide an "Export to CSV or Txt" from File manager so we don't need to do all this nonsense or learn the craft of the computer geek to do simple folder and file management. Not everything works best visually as pictures.

12 Ekim 2019 Cumartesi 01:11
• Halleluiah brother, and pass the wine. Finally. Thank you for this solution. Does just what I need without complexity.

BTW: In Windows Command Prompt, the help command is:  >help for

12 Ekim 2019 Cumartesi 01:24
• This captured a Win10 search output screen, but didn't turn it into columns for date and size etc.
12 Ekim 2019 Cumartesi 01:25
• 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,"%~dpp">>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

%~dpp - file path including drive

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

12 Ekim 2019 Cumartesi 06:42
• Very useful. Thanks!

Could I suggest the path output is more useful as "%~dpp" to include the drive when scanning multiple drives on the machine?

Just an observation... it's amazing that we still need ancient DOS command line "spells" to make Windows do some pretty obvious and simple things. Some would say we're fortunate to be able to get into the weeds... I used to as well, but I'm over that - I don't have a computer to play in the weeds... I have it to make me more profitable or to explore higher math.

13 Ekim 2019 Pazar 03:49