Created
July 10, 2013 16:01
-
-
Save jamiehs/5967534 to your computer and use it in GitHub Desktop.
Average file size within a directory.
http://vivekjain10.blogspot.com/2008/02/average-file-size-within-directory.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To calculate the average file size within a directory: | |
ls -l | gawk '{sum += $5; n++;} END {print sum/n;}' | |
# If you'd like to know the average size of some particular kind of file: | |
ls -l *.jpg | gawk '{sum += $5; n++;} END {print sum/n;}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment