@ -2,7 +2,7 @@
set -euxo pipefail;
backupsToKeep={{ backups_to_keep }};
backupsToKeep={{ backups_to_keep | quote }};
function onlyDatedFiles() {
grep --perl-regexp '/\d+(-\d+)*(\.[^/]+)*$';
@ -16,6 +16,6 @@ find {{ backups_directory | quote }} -type f |
onlyDatedFiles |
getDirName |
sort --unique |
while read dir; do
while read -r dir; do
find "$dir" -type f | onlyDatedFiles | sort --reverse | tail --lines=+$((backupsToKeep + 1)) | xargs rm --force;
done