0

Recently I used the command:

dir /s /on > FileList.txt

Which turned out to be very usefull for that situation.

Now I have another issue where I would like to use a same procedure to check all folder sizes within a certain directory. However I don't like to have all subfiles (and folders) in the output (/s in the line above). Actually I just want to have all sizes of the folders in a specific directory without using RMB>properties on each folder or installing third party software.

Someone got an idea how to do this?

Ruben
  • 90
  • 1
  • 2
  • 10

1 Answers1

1
for /f "usebackq tokens=2* delims= " %i IN (`dir "%windir%" /a /s ^|findstr /i /v "\/"`) DO @echo %j&echo.

or to do user folders

  for /f "skip=2 tokens=3" %A in ('Reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Desktop"') do set doc=%A

  for /f "usebackq tokens=2* delims= " %i IN (`dir "%doc%" /a /s ^|findstr /i /v "\/"`) DO @echo %j&echo. 
  • I tried that first line of code but noting happens? Moreover I'm not really experienced in using the command line, so maybe you could also explain the code a bit? And btw... I would like to write te result in a (txt-)file – Ruben Jun 22 '16 at 06:29
  • You PASTE the line in. If in a batch file you use `%%i` instead of `%i` when typing or pasting. Any output can be written to a file by suffixing `> filename.ext` to a command line. See http://stackoverflow.com/questions/31820569/trouble-with-renaming-folders-and-sub-folders-using-batch –  Jun 22 '16 at 07:10
  • If I use that first line it seems to keep running and not finish... With other commands in cmd it goes on to the next line en shows the directory adres. Now the cursor moves to the next line en keeps on blinking and no file is outputted? – Ruben Jun 22 '16 at 10:48
  • It takes a long time. –  Jun 22 '16 at 11:12
  • http://www.jam-software.de/treesize_free/ still I used this piece of third party software... Much easier and faster for me :P – Ruben Jun 23 '16 at 21:55