How to count the number of files in a directory
How to count the number of files in a directory
Non recursive
find targetdir -type f -maxdepth 1 | wc -l
Recursive
find targetdir -type f | wc -l
Recursive and follow symlink
find targetdir -type f -follow | wc -l