list of filetypes by size


/ Published in: Bash
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. #!/bin/bash
  2.  
  3.  
  4. ftypes=$(find . -type f | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq)
  5.  
  6. for ft in $ftypes
  7. do
  8. echo -ne "$ft\t"
  9. find . -name "*${ft}" -exec gdu -bcsh '{}' + | tail -1 | sed 's/\stotal//' | ack '\dM' | sort -k 2 -nr
  10. done

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.