From 1e42636d4bfbd7f8a8a9fed9d42df1ec1625a054 Mon Sep 17 00:00:00 2001 From: Daniel Dolezal <40464775+daniel156161@users.noreply.github.com> Date: Sat, 22 Aug 2020 01:32:30 +0200 Subject: [PATCH] Update pfsense-backup.sh --- pfsense-backup.sh | 3 +++ 1 file changed, 3 insertions(+) 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