I am using this command to find the folders I want and count up the size.
find . -type d -name 'tmp_c*' | xargs du -hcs {} \; +
My version of find does not support -exec. But, this works. However I am not sure if its giving me the right totals on the directories that contain my search string. When I run the command and pipe to less, I see it counting up each folders size, and then it outputs a total every so often. Like this:
140K ./r/g/userid/attach/tmp_c_241091464_2
68K ./r/g/userid/attach/tmp_c_58367014_undefined
2.3G total
If I redirect the output to a file then grep on total, I get this:
2.3G total
978M total
1.1G total
2.0G total
1.1G total
I think this is giving me the right numbers. But how can I take this command one step further and have it sum up the totals for a grand total on one line?
du -hs ./r/g/userid/attach
? – Wildcard Oct 28 '16 at 18:57