Created
August 15, 2013 19:57
-
-
Save chill117/6244241 to your computer and use it in GitHub Desktop.
Automatically delete old backup files.
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 | |
# | |
# Use this script to automatically delete old backup files. | |
# | |
declare -i max_age | |
# Number of days to keep backup files. | |
max_age=10 | |
# Location of backup files. | |
backups_dir="/home/backups/db/" | |
for file in $(find $backups_dir -mtime +$max_age); do | |
rm "$file"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment