coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] du: add --inodes option [was: finding directories with many file


From: Bernhard Voelker
Subject: [PATCH] du: add --inodes option [was: finding directories with many files in a file system]
Date: Mon, 22 Jul 2013 11:43:53 +0200
User-agent: 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).

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

[Prev in Thread] Current Thread [Next in Thread]