How to list all files in HD?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
rodrigo.brasil
Posts: 10
Joined: 20 Jun 2023 16:15

How to list all files in HD?

#1 Post by rodrigo.brasil » 16 Dec 2023 11:58

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?
Last edited by rodrigo.brasil on 16 Dec 2023 13:13, edited 1 time in total.

Post Reply