Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell fastest directory list

Anyone know a fast way to do a recursive directory listing? I am trying to go through a SAN of about 10tb and "get-childitem -include" takes days to run... I know there will be no way to bring it down to minutes but perhaps some way to cut the time to a few hours would be great. I only need a list i can sort through don't need the file properties as I will be using this to find certain types of files on our SAN such as PST files.

If anyone could point me in the direction on how to use the compiled code from HERE I should be good too.

like image 861
Nick W. Avatar asked Dec 07 '22 08:12

Nick W.


1 Answers

I know this is a day late and a dollar short but you can use robocopy for this purpose and it will list paths longer than 255 chars:

robocopy <SourceRoot> <DummyDestinationDir> /MIR /FP /NC /NS /NDL /NJH /NJS /LOG:<LogFilePath> /L

I know it's pretty wordy but robocopy is very quick compared to PowerShell, though I don't know how it would stack up against cmd's dir. You can either redirect std out using ">" or site the /LOG: parameter like above. I would test to see which is faster. Note do not use the /TEE option console output slows robocopy down in my experience. Also note the file paths will be indented in the output but this is easily rectified with a text editor than can trim leading and/or trailing whitespace.

like image 79
Steven Avatar answered Dec 12 '22 02:12

Steven