Return to Snippet

Revision: 70072
at November 16, 2015 17:13 by alfirth


Initial Code
#!/bin/bash


ftypes=$(find . -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq)

for ft in $ftypes
do
echo -ne "$ft\t"
find . -name "*${ft}" -exec gdu -bcsh '{}' + | tail -1 | sed 's/\stotal//' | ack '\dM' | sort -k 2 -nr
done

Initial URL
http://serverfault.com/questions/367185/calculating-total-file-size-by-extension-in-shell

Initial Description
on OSX brew install coreutils; brew install ack
adapted from http://serverfault.com/questions/367185/calculating-total-file-size-by-extension-in-shell

Initial Title
list of filetypes by size

Initial Tags

                                

Initial Language
Bash