count number of files in each folder and subfolder and save amount in the folderbat code example
Example: How to count number of files in each directory
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr