Shell snippets: sum file sizes
Quick one-liner to add up the (apparent) disk space taken up by files.
The following sample adds up the disk space of image files in the current directory and below, and shows it onscreen, in gibibytes.
find -name *.img -type f | xargs python -c \
'import sys, os ; print sum(os.stat(x).st_size for x in sys.argv[1:]) / (1024*1024*1024)'