How to list sub directory sizes in megabytes - Noob vs. Pro

AI Noob Answer:

"on a Linux or macOS system type:

du -sh * | awk '{print $1}'
... how awkward. produces an output like: 16K 92K 224K 4.0K - without any folder names!

On Windows, you can use the dir command to list sizes of subdirs in bytes

dir /s /b | findstr /s /c:""

then convert sizes to megabytes by dividing by 1048576   ... sincerely? and it produces an error: "missing argument after /c"

Is that useful? Not really ...

It's as stupid as: "Build a robot and train his AI to 'DIR foldername' every subfolder, read the size in bytes, convert it to megabytes, and write that to a summarizing text file. Should only take five years."


 

Pro Answer:

Forget the above junk, download the free open source SFK for any system and type:

sfk treesize mydir

Done. Example output:

4 mb, 17 files, mydir\foo
3 mb,  3 files, mydir\bar
7 mb, 10 files, mydir\hoo

Read the full syntax here.

Big mystery uncovered!
   How to list the newest files in a folder

PC users cannot believe!
   How to list the biggest files in a folder