How many files in a directory.. with find and wc
I’ve had to figure out how many files are in a directory about a billion times now… and the easiest way I’ve done it is
cd /directory-in-question
find . | wc -l
This introducting WC, wordcount… Wordcount works in many ways, however it can be used to count lines in a file or directory listing or a find or whatever you need…
output is something like:
$ find . | wc -l [ENTER}
325
$
Saying I have 325 files in the directory (and any subdirectories)