Ubuntu – Find number of files in folder and sub folders

command linefind

I want to find the total count of the number of files under a folder and all its sub folders.

Best Answer

May be something like

find . -type f | wc -l

would do the trick. Try the command from the parent folder.

find . -name <pattern> -type f finds all files in . and subfolders. The result (a list of files found) is passed (|) to wc -l which counts the number of lines. -name <pattern> only looks for certain files.