I'm looking for a way to produce a list of all the directories in the current working directory sorted by the total number of files that are contained with them.
Initially I though that Nautilus could be used for this, but then I realised it doesn't count files in the sub directories.
The best I've got for a command line solution so far is this
Code:
$ find . -type d -maxdepth 1 | while read thing;do find "$thing" | wc -l | tr '\n' ' ' ; echo "$thing"; done | sort -nr
Anyone get a better solution?
The use case for this is a situation where a user has a quota applied to their home directory which limits the number of files they are allowed to have and they have exceeded that limit.
I assure this is not homework, I'm far too old