In other words, there is no such command -- you can't stat a directory and 
sum up the size of the contents.  You do have to use find and xargs and 
stat and awk, but du will so it much more easily.

Mike


On Sun, 6 Apr 2014, Mike Miller wrote:

> On Sun, 6 Apr 2014, David Wagle wrote:
>
>> You can stat a directory, you do not need to have awk sum things up for 
>> you.
>
> If that is true, then I'll agree with your assessment, but I haven't been 
> able to figure that out.  How can it be done?  I don't see any documentation. 
> You suggested this command...
>
> stat --format=%s
>
> ...but when I run it on a directory...
>
> stat --format=%s dir
>
> ...it does not look at contents and just gives me the file size I get from 
> the ls -ld command:
>
> $ stat --format=%s miller
> 4096
>
> $ ls -ld miller
> drwxrwxr-x. 3 millerm1 guanwh 4096 Mar 28 12:27 miller
>
> That directory contains many gigabytes of files (see below), so 4096 is not 
> the answer we're looking for.
>
> Mike
>
>
>> On Sat, Apr 5, 2014 at 6:58 PM, Mike Miller <mbmiller+l at gmail.com> wrote:
>> 
>>> On Sat, 5 Apr 2014, David Wagle wrote:
>>>
>>>  why it violates the unix philosophy - in my mind - is that apparent size
>>>> has nothing to do with he primary function of du - which is to display 
>>>> disk
>>>> usage. And the unix philosophy is to do one thing and do it well.
>>>> 
>>>> the apparent size flag for du is trying to get du to do things that other
>>>> utilities already do.
>>>> 
>>> 
>>> 
>>> Do you mean like find + xargs + awk working in combination...
>>> 
>>> 
>>> $ find miller -print0 | xargs -0 stat --format=%s | awk
>>> '{sum+=$1}END{print sum}'
>>> 145159848954
>>> 
>>> ...(adding a for loop to deal with a list of directories), or do you mean
>>> that some utility actually does this?
>>> 
>>> What was wrong with my argument about the space that would be used on a
>>> tape if the files were to be written to tape via tar command?
>>> 
>>> What was wrong with my argument about the size of the files on a
>>> compressed disk?
>>> 
>>> 
>>> Mike
>>> _______________________________________________
>>> TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
>>> tclug-list at mn-linux.org
>>> http://mailman.mn-linux.org/mailman/listinfo/tclug-list
>>> 
>> 
>