Created
May 22, 2017 13:54
-
-
Save alaq/592473cf7b85d600e819e04d15bab747 to your computer and use it in GitHub Desktop.
Tally up data added within a day, total bytes, and human readable format
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 | |
# Change folder and output below | |
# Run with @daily cron | |
folder=YOUR FOLDER | |
output=YOUR OUTPUT FILE | |
today=`date +%Y-%m-%d -d "yesterday"` | |
sum=$(find $folder -mtime -1 -printf "%s\n"|awk '{t+=$1}END{print t}') | |
readablesum=$(numfmt --to=iec $sum) | |
echo "$today $sum $readablesum" >> $output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment