linux count files in directory and subdirectories recursively code example
Example 1: linux count files in subdirectories
find . -type f | cut -d/ -f2 | sort | uniq -c | sort -nr
Example 2: how to count all files in a directory linux recursively
find DIR_NAME -type f | wc -l