stouputils.backup.limiter module#
- limit_backups(
- max_backups: int,
- backup_folder: str,
- keep_oldest: bool = True,
Limits the number of delta backups by consolidating the oldest ones.
If the number of backups exceeds max_backups, the oldest backups are consolidated into a single backup file, then deleted, until the count is within the limit.
- Parameters:
max_backups (int) – Maximum number of delta backups to keep
backup_folder (str) – Path to the folder containing backups
keep_oldest (bool) – If True, never delete the oldest backup (default: True)
Examples:
> limit_backups(5, "/path/to/backups") [INFO HH:MM:SS] Limiting backups [INFO HH:MM:SS] Consolidated 3 oldest backups into '/path/to/backups/consolidated_YYYY_MM_DD-HH_MM_SS.zip' [INFO HH:MM:SS] Deleted 3 old backups