Recursively count files

Written by
Date: 2013-06-20 15:32:13 00:00

Spanish version

How to know how many files are there recursively in a folder?

The answer to that questions is easy to answer with this command.

find [YOUR_FOLDER] -type f ¦ wc -l

If you want to start in the current folder the command is:

find . -type f ¦ wc -l 

And if you want a specific type of file, you can use:

find . -type f -name "*.txt" ¦ wc -l 

In that case it will count all files with txt extension that are in the current folder and its sub-folders.