count number of files in a directory and subdirectory linux code example
Example: linux count files in subdirectories
find . -type f | cut -d/ -f2 | sort | uniq -c | sort -nr
find . -type f | cut -d/ -f2 | sort | uniq -c | sort -nr