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).

Thanks.
I had a look into src/du.c and adding such an --inodes option
was pretty easy, see attached patch.

Comments?

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" .
  0 .
  $ du --ino .
  1     .

Have a nice day,
Berny

Attachment: du-inodes.patch.xz
Description: application/xz

Reply via email to