From 1bddfe2b3d45248d93b90d1210ecaf44041a3e50 Mon Sep 17 00:00:00 2001 From: Codex Date: Sun, 20 Sep 2026 20:48:42 -0300 Subject: [PATCH] Prune legacy zstd archive names --- README.md | 3 ++- stages/90-prune.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a9a4b8c..648ec57 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ logic remains common and can be updated through Git. 1. `stages/10-containers.sh` — stop, archive, pull, start and verify projects. 2. `methods/20-rclone.sh` — copy archives to an rclone destination when enabled. 3. `methods/30-smb.sh` — copy archives to a mounted SMB share when enabled. -4. `stages/90-prune.sh` — retain the newest configured number locally. +4. `stages/90-prune.sh` — retain the newest configured number of `.zst` + archives locally, including legacy `.zst` and current `.tar.zst` names. Every stage can also be run directly. The old `docker-backup.sh` name invokes the container archive stage, while `dockerbackup_prune.sh` invokes the local diff --git a/stages/90-prune.sh b/stages/90-prune.sh index 6c1d5f9..fe1fc5d 100755 --- a/stages/90-prune.sh +++ b/stages/90-prune.sh @@ -16,7 +16,8 @@ done require_positive_integer KEEP_COUNT "$KEEP_COUNT" [[ -d "$BACKUP_ROOT" ]] || { log SKIP "Backup root does not exist: $BACKUP_ROOT"; exit 0; } while IFS= read -r -d '' dir; do - mapfile -d '' -t files < <(find "$dir" -maxdepth 1 -type f -name '*.tar.zst' -printf '%T@ %p\0' | sort -z -nr | cut -z -d' ' -f2-) + # Match both current *.tar.zst archives and legacy *.zst archives. + mapfile -d '' -t files < <(find "$dir" -maxdepth 1 -type f -name '*.zst' -printf '%T@ %p\0' | sort -z -nr | cut -z -d' ' -f2-) (( ${#files[@]} > KEEP_COUNT )) || continue for file in "${files[@]:KEEP_COUNT}"; do if (( DRY_RUN )); then log WOULD "Remove $file"; else rm -f -- "$file"; log DELETE "Removed $file"; fi