How can I recursively count files in a Linux directory?
I found this:
find DIR_NAME -type f ¦ wc -l
find: paths must precede expression: ¦
This should work:
find DIR_NAME -type f | wc -l
-type fto include only files.
findcommand's standard output to
wccommand's standard input.
wc(short for word count) counts newlines, words and bytes on its input (docs).
-lto count just newlines.
.to execute the command in the current folder.
-type fto include directories (and symlinks) in the count.