Linux

Command to count and print the number of files along with the corresponding directory names on Linux

To count the number of files in directories and print the file count along with the corresponding directory names on Linux, you can use various methods depending on the environment and specific requirements.
Command

for i in `ls -1b`; do c=`find $i -type f |wc -l`; echo "$c $i"; done;

Or an other Command

find /your-path -type f -exec dirname {} \; | sort | uniq -c

This command is very effective in checking which folder's files are consuming the most inodes.

Thanks for visit my website