From time to time one needs to count the size of all files matching a certain pattern.
The following command will print a list of all matching files and their size in a human readable form. At the end a sum of all files will be printed.
find . -name '*.<file-ending>' -print0 | xargs -r0 du -csh;
If you only need the total and not the individual files incl. their sizes just add a |tail -n1
before the last ;
Greetings
.sascha