prune
8BitSafe-cli [common options] archive prune [options] [REPOSITORY]
| positional arguments | description |
|---|---|
| REPOSITORY | repository to prune |
| optional arguments | description | default | allowed |
|---|---|---|---|
| --dry-run | do not make any changes | - | |
| --keep-last, --keep-secondly | number of secondly archives to keep | - | (integer) |
| -H, --keep-hourly | number of hourly archives to keep | - | (integer) |
| -d, --keep-daily | number of daily archives to keep | - | (integer) |
| -w, --keep-weekly | number of weekly archives to keep | - | (integer) |
| -m, --keep-monthly | number of monthly archives to keep | - | (integer) |
| -y, --keep-yearly | number of yearly archives to keep | - | (integer) |
| -p, --prefix | only consider archive names starting with this prefix | - | (string) |
| --keep-auto | do 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.
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
- Windows
- Unix
- Remote Storage
Keep the last 16 archives but only list what will be removed:
8BitSafe-cli.exe archive prune --dry-run --keep-last 16 D:\backups\repo
Keep the last 16 archives and delete others:
8BitSafe-cli.exe archive prune --keep-last 16 D:\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.exe archive prune -d 7 -w 7 -m 4 D:\backups\repo
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
Keep the last 16 archives but only list what will be removed:
8BitSafe-cli archive prune --dry-run --keep-last 16 remote
Keep the last 16 archives and delete others:
8BitSafe-cli archive prune --keep-last 16 remote
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 remote