Wiki‎ > ‎

Recursively count files in a Linux directory

posted Jan 9, 2015, 10:37 AM by Dong Xu
find DIR_NAME -type f | wc -l

Explanation:

  • -type f to include only files.
  • | redirects find's command output to wc command.
  • wc (short for word count) counts newlines, words and bytes on its input (docs).
  • -l to count just newlines.
Comments