From 9b2fd6cadb298797e5ade973bfb752992cda2d17 Mon Sep 17 00:00:00 2001 From: Chris Tarazi Date: Sun, 20 Nov 2016 14:00:05 -0800 Subject: [PATCH] Fix command for finding and deleting old backups --- backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backup.sh b/backup.sh index 6860e3f..d95d6b6 100755 --- a/backup.sh +++ b/backup.sh @@ -180,7 +180,7 @@ if [ $BACKUP_SUCCESS = 0 ]; then echo -e "${green}${bold}RaspberryPI backup process completed! FILE: $OFILE${NC}${normal}" | tee -a $DIR/backup.log echo -e "${yellow}Removing backups older than $RETENTIONPERIOD days${NC}" | tee -a $DIR/backup.log - sudo find $DIR -maxdepth 1 -name "*.img" -o -name "*.gz" -mtime +$RETENTIONPERIOD -exec rm {} \; + sudo find $DIR -maxdepth 1 -mtime +$RETENTIONPERIOD \( -name "*.img" -o -name "*.gz" \) -exec rm {} \; echo -e "${cyan}If any backups older than $RETENTIONPERIOD days were found, they were deleted${NC}" | tee -a $DIR/backup.log