Find number of files in folder and sub folders?
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.
Use the tree
command. You might need to install the tree
package.
It will list all the files and folders under the given folder and list a summary at the end.
To count files (even files without an extension) at the root of the current directory, use:
ls -l | grep ^- | wc -l
To count files (even files without an extension) recursively from the root of the current directory, use:
ls -lR | grep ^- | wc -l