rblog

Summarize disk usage of all files of a given type

Needed to know how much disk space all *.ear-files was consuming in a directory on one of our Linux-servers


find . -type f -name "*.ear" -exec ls -l {} \; | awk '{print $5}' > sum.txt
awk '{ sum += $1 } END { print sum }' sum.txt 

Then I used Google to make the number human readable, https://www.google.no/search?q=9606676582+bytes+to+gb