count number of files in folder code example
Example 1: count files recursively linux
find DIR_NAME -type f | wc -l
Example 2: How to count number of files in each directory
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr
Example 3: number all files in a folder
ls -v | cat -n | while read n f; do mv -n "$f" "$n.ext"; done