GNU bug report logs - #61884
add an option to du that allows to control which file types are counted

Previous Next

Package: coreutils;

Reported by: Christoph Anton Mitterer <calestyo <at> scientia.org>

Date: Wed, 1 Mar 2023 03:20:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 61884 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Christoph Anton Mitterer <calestyo <at> scientia.org>, 61884 <at> debbugs.gnu.org
Subject: Re: bug#61884: add an option to du that allows to control which file
 types are counted
Date: Thu, 2 Mar 2023 16:01:05 +0000
On 01/03/2023 03:18, Christoph Anton Mitterer wrote:
> Hey.
> 
> When I want to count the nominal sizes of the (usually regular) files
> in a directory I do something like:
> 
> du --apparent-size --block-size=1
> 
> This however also counts in the sizes of the directories themselves
> (and I guess also of symlinks, etc.).
> 
> 
> The "problem" with that is in particular, that for the exact same
> dir/file structure, the results differ e.g. between ext4 and btrfs,
> because of different sizes for the directories (themselves).
> 
> It would be nice if there was a option that allowed to select which
> file types are counted.
> 
> 
> Yes I know that one can do something like:
> find . -type f -print0  |  du --apparent-size -l -c -s --block-size=1 --files0-from=- | tail -n
> 
> But that's rather cumbersome... also I cannot do something like
> du path1 path2 path3
> and get totals for each and a grand summary.
> 
> And even if I make an shell alias out of this, I cannot do bash completion on it.

There are many possible filtering options,
which are probably best left to `find` (as per your example).
This was also mentioned previously at:
https://lists.gnu.org/archive/html/coreutils/2013-04/msg00043.html

cheers,
Pádraig




This bug report was last modified 2 years and 127 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.