[TriLUG] [bash] get total size of list of directories?
Owen
oberry at trilug.org
Mon Apr 14 10:06:21 EDT 2008
$ du -sc images imagesmpxl programs
557740 images
69591 imagesmpxl
226317 programs
853647 total
The -c option give you the total.
Owen
On Sun, Apr 13, 2008 at 07:18:27PM -0400, Tom Roche wrote:
>
> Can one get the total size of a list of directories via shell
> scripting? I know I can do something like
>
> $ find /this -maxdepth 1 -type d | grep -ve
> '/this$\|norThat$\|norTheOther$' | xargs du -hs
>
> but that just gives me the size of each dir in the list, and
>
> $ find /this -maxdepth 1 -type d | grep -ve
> 'this$\|norThat$\|norTheOther' | du -hs
>
> fails oddly: value reported is wildly low, so I suspect it's just
> getting one directory then returning. How to get the sum of all?
>
More information about the TriLUG
mailing list