I'm launching a course about Next.js + React.jsLearn more

Recursively count files using find

2018-05-08 · 1 min read

Combine find and wc to count files in the current directory and in all of its subdirectories:

find . -type f | wc -l
  • -type f: include only files
  • wc -l: count lines only

If you remove -type f it will also count directories and symlinks.

Add -name "*.EXT" to count files with the specific extension. In the example below it counts only CSV files

find . -type f -name "*.csv" | wc -l

My Tech Newsletter

Get emails from me about programming & web development. I usually send it once a month