From 4398a65453087a7204147776067b81f9c5df82dc Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 30 Jan 2018 22:19:23 +0100 Subject: [PATCH] fixed checking if the backup folder is empty --- backup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backup.sh b/backup.sh index 532f3a0..b4ef8ee 100755 --- a/backup.sh +++ b/backup.sh @@ -77,6 +77,7 @@ if [ ! -d $backup_folder ]; then echo "Could not create Backup folder. Please make sure you have sufficent rights to create $backup_folder" exit 1 fi + echo "-------------------------------" fi # Check if the config file exists @@ -86,7 +87,7 @@ fi date=`date +%d\-%m\-%Y\_%H\-%M\-%S` # Delete backups older than three days if there are any -if [ ! "$(ls -A $backup_folder)" ]; then +if [ "$(ls -A $backup_folder)" ]; then echo "Deleting Backups older than three days..." find $backup_folder/* -type d -ctime +3 | xargs rm -rf echo "Deleted."