Efficiently Building Directory Listings

Soldato
Joined
25 Oct 2002
Posts
2,662
I have a file share with multiple millions of directories and tens of millions of files. I would like to to identify the paths to all files of a particular type but I'm not sure of the most efficient way of doing this.

At the most basic level I could use Powershell and recursively work from the top to the bottom with something like this, but I have no idea how it would behave over such a large structure.

Code:
get-childitem -force -recurse -filter "*.doc" | Select Name, FullName | Export-Csv dir.txt -Encoding ascii -NoTypeInformation

Does anyone have any experience or recommendations as to how to approach this?
 
dir?
ie the following will display the full file path of all .doc's in the dir and sub folders.


dir /A /S /B *.doc

output to file
dir /A /S /B *.jpg >>file.txt
 
The method LizardKing gives is probably the simplest way to do what you're asking.
dir is perfect for a basic report, not so good if you want a nicely formatted csv - It depends what purpose the data is being put to, are there other details you require like filesize, owner, etc?
 
Back
Top Bottom