Page 1 of 1

How to list all files in HD?

Posted: 16 Dec 2023 11:58
by rodrigo.brasil
Ok, the answer is simple, just:

Code: Select all

dir /s
Or if you want to list in ALL disks, just do:

Code: Select all

for /f "tokens=2* usebackq delims==" %x in (`wmic logicaldisk get caption /value`) do @(for /f "delims=:" %y in ("%x") do @(dir  %y:\))
But there is a bug in the dir /s command. If I am administrator (privilege) when there is a Directory JUNCTION it loop and list the same folder over and over. I didn't find a way to not list this juncion.

I can't use Powershell, only cmd.exe. And I can't use forfiles cmd, because it is really slow. For every file it will need to start a new cmd to print the value. If I try to list all files, it will take a lot of time!

So: How can I list all files in HD as Administrator:
  • Using ONLY default windows tools?
  • Using small software to do it with command line?
And I need to get the size and the last time it was changed, like normal dir. How can I make this?