diff --git a/pfsense-backup.sh b/pfsense-backup.sh index 1696b30..3d21a3b 100755 --- a/pfsense-backup.sh +++ b/pfsense-backup.sh @@ -65,6 +65,9 @@ if [ $cron -eq 1 ]; then crond -f else do_backup + if [ ! -z $keepfiles ]; then + ls -d -1tr $destination/* | head -n -$keepfiles | xargs -d '\n' rm -f + fi fi else do_backup