Get total file size of all specified folders recursively

Steve Robbins asked:

I’m using svn on a project and I’m trying to see how much file space all of the .svn folders are taking up.

If I do something like

du -h | egrep ".*\.svn$"

It will list all of the .svn folders and their sizes, but on 3k+ lines. How can I total all these lines (or perform an operation that would give me the equivalent result)?

My answer:

du -shc `find . -name .svn -print`

-print can be omitted if you are using find from GNU coreutils.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.