Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash sum file sizes in folder group by file type
types=($(find . -type f -name '*.*' | sed 's|.*\.||' | sort -u))
for type in ${types[@]}; do
sum=$(find . -type f -name "*.$type" -exec du -ch {} + | grep total$)
echo "$type : $sum"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment