/ Published in: Bash
on OSX brew install coreutils; brew install ack
adapted from http://serverfault.com/questions/367185/calculating-total-file-size-by-extension-in-shell
adapted from http://serverfault.com/questions/367185/calculating-total-file-size-by-extension-in-shell
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/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
URL: http://serverfault.com/questions/367185/calculating-total-file-size-by-extension-in-shell