[TriLUG] [bash] get total size of list of directories?

Tom Roche Tom_Roche at pobox.com
Sun Apr 13 19:18:27 EDT 2008


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?

TIA, Tom Roche <Tom_Roche at pobox.com> first trilug post from my eee!



More information about the TriLUG mailing list