Created
April 13, 2011 02:47
-
-
Save silvein/916874 to your computer and use it in GitHub Desktop.
This is a one-liner to sum the total size of all files (in gigabytes) in a specific directory and period (monthly).
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
#!/bin/bash | |
find $1 -type f -printf "%CY%Cm %s %p\n" | | |
/usr/bin/awk '{ total[$1] += $2 } END { for (period in total) printf "%s: %f\n", period, total[period]/1024^3 }' | | |
sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like this:
201006: 5.515946
201007: 6.434511
201008: 6.302867
201009: 4.725753
201010: 5.163738
201011: 4.569330
201012: 7.170505
201101: 5.824497
201102: 4.209730
201103: 4.658753
201104: 2.286961