Created
January 28, 2014 21:11
-
-
Save charles-hollenbeck/8676586 to your computer and use it in GitHub Desktop.
Checks a directory's size and cleans it out if it's too large.
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 | |
size=$(du /home/charles/screenshots --bytes | grep '[0-9]*' -o) | |
max=$(expr 1024 \* 1024 \* 1024 \* 2) | |
if [[ "$size" -gt "$max" ]]; then | |
rm /home/charles/screenshots/* | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment