Update pibackup.sh

This commit is contained in:
2022-12-16 14:17:13 -06:00
parent fafa66738e
commit 1aeadd04a6

View File

@@ -56,13 +56,13 @@ if [ "$1" != "update" ]; then
[ $TEST != true ] && sleep 1m
echo "$(date) - Removing old backups..."
allfiles=`ls -1 ${BackupDir}/*.img.gz`
allfiles=`ls -1 ${BackupDir}/*.img*`
if [ "${BackupsToKeep}" == "" ]; then
BackupsToKeep=3
fi
files=(`ls -1 ${BackupDir}/*.img.gz | tail -${BackupsToKeep}`)
files=(`ls -1 ${BackupDir}/*.img* | tail -${BackupsToKeep}`)
for i in $allfiles; do keep=0;
for a in ${files[@]}; do
if [ $i == $a ]; then keep=1; fi;