Since I'm having performance problems with rsnapshot, I'd like to identify directories with great number of files recursively. I think the problem is not the size of the files, but the file count in particular subdirectories, because the generations (daily.0, daily.1, ...) are not volatile and only have few changes compared to the total number of files.
du would be exactly what I want, if it returned only the file count and not the sum of file sizes.
I already have a bash script which outputs the file count of all direct subdirectories (recursing into subdirectories), but it's cumbersome to use, because I have to dig deeper and deeper and always have to wait.
Found also a script digging deeply, but not summing up file count of subdirectories. It shows only the number of files in this directory, not from its children.
dir1/ file1 subdir1/ file2, file3, file4, file5 subdir2/ file6, file7, file8 subdir3/ file9 dir2/ fileA, fileB
Desired output (listing subdirectories and sum up to top):
4 dir1/subdir1 1 dir1/subdir2/subdir3 4 dir1/subdir2 9 dir1/ 2 dir2/
What I don't want (only listing totals):
9 dir1/ 2 dir2/
and not (only listing file count of
4 dir1/subdir1 1 dir1/subdir2/subdir3 3 dir1/subdir2 1 dir1/ 2 dir2/