terminal: count all files - including in sub folders
find DIR_NAME -type f | wc -l
Explanation:
-
-type fto include only files. -
|redirects find command's standard output to wc command's standard input. -
wc(short for word count) counts newlines, words and bytes on its input (docs). -
-lto count just newlines.
Notes:
-
Replace
DIR_NAMEwith.to execute the command in the current folder. -
On some systems (e.g. OS X) you can omit
.for execute in the current folder -
You can also remove the
-type fto include directories (and symlinks) in the count. -
It's possible this command will overcount if filenames can contain newline characters.
Pro tip:
If you want a breakdown of how many files are in each dir under your current dir:
for i in */ ; do echo -n $i": " ; (find "$i" -type f | wc -l) ; done find . -type f | wc -l
Windows
folders:
dir /a:d /s /b "DIR_PATH" | find /c ":"
files
dir /a:-d /s /b "DIR_PATH" | find /c ":"
On window you can omit "DIR_PATH" with . too.
No comments to display
No comments to display