Skip to main content

prune

8BitSafe-cli [common options] archive prune [options] [REPOSITORY]
positional argumentsdescription
REPOSITORYrepository to prune
optional argumentsdescriptiondefaultallowed
--dry-rundo not make any changes-
--keep-last, --keep-secondlynumber of secondly archives to keep-(integer)
-H, --keep-hourlynumber of hourly archives to keep-(integer)
-d, --keep-dailynumber of daily archives to keep-(integer)
-w, --keep-weeklynumber of weekly archives to keep-(integer)
-m, --keep-monthlynumber of monthly archives to keep-(integer)
-y, --keep-yearlynumber of yearly archives to keep-(integer)
-p, --prefixonly consider archive names starting with this prefix-(string)
--keep-autodo not delete auto commit archives-

Description

The prune command removes archives similar to the delete command but uses retention options to decide which archives to keep.

This command is useful for automated backup scripts wanting to keep a number of historic backups.

The command supports simply just keeping N backups or more complex rules that thin the number of backups kept over time. For example keep a backup for all previous 7 days, then only keep one backup per a week for 4 months then only keep one backup per a month for the remainder of the year.

--keep-*

Options starting with --keep-* can be combined and are applied hourly to yearly, and backups selected by previous rules do not count towards those of later rules. The time that each backup completes is used for pruning purposes.

danger

This command permanently deletes all data referenced by removed archives

Dry run

We strongly recommend using --dry-run to test your command as this command permanently deletes all data contained in the removed archives.

Examples

info

Keep the last 16 archives but only list what will be removed:

8BitSafe-cli archive prune --dry-run --keep-last 16 /mnt/backups/repo

Keep the last 16 archives and delete others:

8BitSafe-cli archive prune --keep-last 16 /mnt/backups/repo

Keep 1 archive for the previous 7 days, 1 archive per a week for 7 weeks, 1 archive per month for 4 months:

8BitSafe-cli archive prune -d 7 -w 7 -m 4 /mnt/backups/repo