[Top][All Lists]

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

Re: finding directories with many files in a file system

From: Bernhard Voelker
Subject: Re: finding directories with many files in a file system
Date: Fri, 26 Jul 2013 16:45:18 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

On 07/26/2013 02:49 PM, Pádraig Brady wrote:
> This patch is simple and probably makes sense as a complement to df -i.

Yes and yes ;-)

> Why not support --threshold BTW?
> Could --threshold be an inode count rather than byte count with --inodes?

Good point!
Supporting this boils down to:

diff --git a/src/du.c b/src/du.c
index 5c74285..60b91b8 100644
--- a/src/du.c
+++ b/src/du.c
@@ -604,9 +604,10 @@ process_file (FTS *fts, FTSENT *ent)
       || level == 0)
       /* Print or elide this entry according to the --threshold option.  */
+      intmax_t v = opt_inodes ? dui_to_print.inodes : dui_to_print.size;
       if (opt_threshold < 0
-          ? dui_to_print.size <= -opt_threshold
-          : dui_to_print.size >= opt_threshold)
+          ? v <= -opt_threshold
+          : v >= opt_threshold)
         print_size (&dui_to_print, file);

Attached is the amended patch: I also changed coreutils.texi and
tests/du/ accordingly.

Do you think that the description of --threshold should be adapted?
I mean, the word "SIZE" may be misleading.  Well, I think it's quite
okay ... ;-)

Have a nice day,

Attachment: du-inodes2.patch
Description: Text Data

reply via email to

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