How to find which directory has the most number of files?
Please suggest,
How to find which directory has the most number of files ? |
Show us what code you've done so far
|
Are you looking for any command or a script? Once go through manual of find command here.
|
possibly the simplest way:
Code:
find . -depth -type d -print -a -exec sh -c "ls -C1 {} | wc -l " ';' |
Quote:
i've modified this shell script which display no of files in each directory. PHP Code:
Code:
# pwd |
missed the directory entries (which are also files...)
ah - a contest :) And you can get the same from: Code:
find . -depth -type d -exec sh -c "echo -n {} :; ls -C1 {} | wc -l " ';' Code:
find . -depth -type d -exec sh -c 'echo `ls -C1 {} | wc -l ` {}' ';' | sort -n -r and empty directories at the bottom (the -r option on the sort). |
Quote:
|
Might as well spruce it up a little:
Code:
find . -depth -type d -exec sh -c "echo -n {} ' '; ls -C1 {} | wc -l " ';' | sort -n -k2 |
All times are GMT -5. The time now is 11:21 AM. |