bug-coreutils
[Top][All Lists]
Advanced

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

Re: du v5.93: traverses subdirectories although --separate-dirs and --su


From: Volker Badziong
Subject: Re: du v5.93: traverses subdirectories although --separate-dirs and --summarize are set?
Date: Thu, 29 May 2008 15:41:21 +0200

Hi,

I do not understand why this is necessary if the results from subdirectories 
are not taken into account? Or asked the other way: What information from the 
traversal process is taken into the total sum?

E.g. look at the following. du yields almost the same as "ls sums without dirs" 
- although I cannot explain why these two do not match?!

somehost:/ # sum=0; for var in $(ls -l /etc/ | grep -v "^d" | awk '{print 
$5}'); do sum=$(($sum + $var)); done; echo "erg: $sum"
erg: 2574839
somehost:/ # sum=0; for var in $(ls -l /etc/ | awk '{print $5}'); do 
sum=$(($sum + $var)); done; echo "erg: $sum"
erg: 2902519
somehost:/ # du  --separate-dirs  --apparent-size --block-size=1  --summarize  
/etc/
2583031 /etc/

Thanks and Regards,
Volker Badziong


-------- Original-Nachricht --------
> Datum: Thu, 29 May 2008 09:27:51 -0400
> Von: Bo Borgerson <address@hidden>
> An: Volker Badziong <address@hidden>
> CC: address@hidden, address@hidden
> Betreff: Re: du v5.93: traverses subdirectories although --separate-dirs and 
> --summarize are set?

> Volker Badziong wrote:
> > Hello,
> > 
> > I am running "du (GNU coreutils) 5.93". When executing e.g.
> > 
> >      du --separate-dirs --summarize  /etc/
> > 
> > you are only interested in the total space consumed by stuff in /etc/,
> not within any subfolders. But nevertheless du traverses all subdirectories,
> regardless if "--summarize" is set or not. This has no effect on the
> produced output / numeric result for /etc/.
> > 
> > Is there a reason the traversal still happens? This causes a lot of (in
> my humble opinion) unncessary IO.
> > 
> > Here is a sample output of running with and without --summarize. Numbers
> for /etc/ are identical, but IO happens in both cases the same.
> > 
> > somehost:/ # du  --separate-dirs --block-size=1   /etc/
> > 94208   /etc/udev/rules.d
> > ...
> > 3076096 /etc/
> > 
> > somehost:/ # du  --separate-dirs --block-size=1  --summarize  /etc/
> > 3076096 /etc/
> 
> 
> I think du actually has to traverse the whole tree in both cases.  The
> difference as I understand it with `--summarize' is that information is
> only _printed_ for the top level.
> 
> Bo

-- 
Super-Aktion nur in der GMX Spieleflat: 10 Tage für 1 Euro.
Über 180 Spiele downloaden: http://flat.games.gmx.de




reply via email to

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