[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] du: add --inodes option [was: finding directories with many file
[PATCH] du: add --inodes option [was: finding directories with many files in a file system]
Mon, 22 Jul 2013 11:43:53 +0200
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5
On 07/19/2013 01:11 AM, Philip Rowlands wrote:
> This gives the non-cumulative total per directory:
> $ find . -xdev -printf '%h\n' | sort | uniq -c | sort -n
> but doesn't handle hard links. You could use -printf '%h %i\n' and
> post-process the duplicate inodes (no per-file stat since find v4.5.4).
I had a look into src/du.c and adding such an --inodes option
was pretty easy, see attached patch.
P.S. I must admit that the (unusual) corner case of listing the
inodes usage of the working directory when it is deleted is not Zero:
$ d=$(pwd)/d ; mkdir $d; cd $d; rmdir $d
$ stat -c "%h %n" .
$ du --ino .
Have a nice day,