In order for me to get the results of a file search in a readable format, I use the following command line in a command prompt:

dir *.* /s > myResultList.txt

I then open that list in Excel, use fixed width format to get rid of all the stuff I don't want and then I have my list.

Seems like a lot to do for something so simple.

Does anyone out there have any recommendations for something that would work better than this?

link|improve this question

Question will be better phrased by including the information you DO want to extract from the DIR results. – Shevek May 13 '10 at 10:19
feedback

migrated from stackoverflow.com May 13 '10 at 9:59

This question came from our site for professional and enthusiast programmers.

5 Answers

up vote 1 down vote accepted

It's a little hard to understand what exactly you're aiming for, but you can get a plain list of files by including the /b switch to dir:

dir /s /b *>foo.txt

If you have requirements for the exact format of the output, then perhaps a for loop might be more appropriate:

(for /r %x in (*) do (@echo."%x";%~tx;%~zx))>foo.csv

This would output a CSV file with the file names, their modification date and time and the file size, which you can easily open in Excel.

If you want a fixed-width format of custom columns—that's ... a little much more complex and I won't provide that here.

link|improve this answer
feedback

find allows you to specify various criteria for searching for files, and lets you generate output using various formatting options.

link|improve this answer
1  
i think his real problem is not the search/find but how to transfer the result of (basically any commandline operation) into excel/word etc. – akira May 13 '10 at 10:10
feedback

another candidate: 'nircmd.exe' with the clipboard subcommand.

link|improve this answer
you could have edited your previous answer's for consolidated answer :) – TuxGeek May 13 '10 at 10:42
yah, but this way people can vote on each answer .. and the best solution will win. – akira May 13 '10 at 11:29
feedback

using 'powershell' and the 'powerShell community extensions' you will get access to the 'get-clipboard' and 'out-clipboard' commands, use them as explained here.

link|improve this answer
feedback

try 'clip.exe' to pipe output to the clipboard on the command line.

update:

since vista there seems to be a 'clip.exe' in C:\Windows\system32.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.