Linux – Recursively counting files in a directory

While development or migration of data we always have a requirement to count the number of files in the current directory or any directory.

How can we recursively count the files in a Linux directory?

find DIR_NAME -type f | wc -l

where -type f to includes only files & wc -l to word count lines.

If you already in the current directory then simply type the following command :

find -type f | wc -l

Leave a Reply

Your email address will not be published. Required fields are marked *