"Volker Badziong" <[EMAIL PROTECTED]> wrote:
> 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 for the report.

--separate-dirs is not useful with --summarize.
The documentation of --separate-dirs is insufficient.

Does this documentation patch make it clearer?

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 982ad3c..5fd2a74 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -9838,8 +9838,12 @@ Display only a total for each argument.
 @itemx --separate-dirs
 @opindex -S
 @opindex --separate-dirs
-Report the size of each directory separately, not including the sizes
-of subdirectories.
+Normally, in the output of @command{du} (when not using @option{--summarize}),
+the size listed next to a directory name, @var{d}, represents the sum
+of sizes of all entries beneath @var{d} as well as the size of @var{d} itself.
+With @option{--separate-dirs}, the size reported for a directory name,
[EMAIL PROTECTED], is merely the @code{stat.st_size}-derived size of the 
directory
+entry, @var{d}.

 @itemx --time
 @opindex --time


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to