1
0
Fork 0
forked from infra/ansible

Rename retention script per feedback

Signed-off-by: Michael Winters <fedora@mwinters.net>
This commit is contained in:
Michael Winters 2026-04-02 09:27:59 -05:00 committed by Kevin Fenzi
commit 2a941c4482
4 changed files with 10 additions and 6 deletions

View file

@ -1,8 +1,12 @@
#!/bin/bash
# vim: ts=4:sw=4:expandtab:tw=100
# Deletes files prefixed with ISO dates (YYYY-MM-DD-) older than RETENTION_DAYS days,
# but always retains the most-recent MIN_KEEP files even if they're "old".
# This script manages a set of backup files which are prefixed with ISO dates (YYYY-MM-DD).
# - As new files come in, we want to delete the old ones.
# - RETENTION_DAYS decides how old is "old".
# - But if no new files come in (e.g. the backup process is broken), we don't want to
# end up deleting _all_ the files, just because they're old.
# - MIN_KEEP decides how many files to keep.
#
# Usage: ./retain.sh --dry-run <directory>