How to list the biggest files in a folder - Noob vs. Pro

AI Noob Answer:

"use "find" on Linux and MacOS:

find /path/to/directory -type f -exec du -h {} + | sort -rh | head -n 10   ... how intuitive.

The "-type f" option tells find to for files, not dirs. "-exec" tells to run the command "du -h" on each file. The "du -h" command ... blabla ...

On Windows, you can use "forfiles":

forfiles /S /M *.* /C "cmd /c echo @file @fsize" /O:D /X     ... bullshit. this command produces an error "invalid option /O:D"!

Is that helpful? Not really.

It's as stupid as: "Build a robot and train his AI to type DIR /OD for every folder and subfolder, rememember the biggest files therein, then think of the overall biggest files and write it into a file. Should only take five years."


 

Pro Answer:

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

sfk big mydir

Done. Example output:

5572 mydir\foo3.txt
5658 mydir\foo1.txt
12905 mydir\media\logo.png

Read the full syntax here.

Office workers cannot believe!
   How to list sub directory sizes in megabytes

PC users go nuts!
   How to remove tab characters from text files