Advanced filtering for borg prune
- Dominant language
- Python
- Stars
- 13.7k
- Forks
- 875
- Avg merge
- 11h 15m
- Merged PRs (30d)
- 192
Description
What is the best way to do filtering of snapshots to prune with `borg prune` based on comments, suffix, dates without times?
Example snapshot list
snapshot (of files) name | snapshot comment | snapshot timestamp
-- | -- | --
files-2021-01-18-144409 | folder only ./some/path | 2021-01-18 14:44:19
files-2021-01-18-144006 | folder only ./path2/files | 2021-01-18 14:40:17
files-2021-01-18-143709 | folder only ./dir1 | 2021-01-18 14:37:19
files-2021-01-18-143115 | folder only ./dir2 | 2021-01-18 14:31:28
snapshot (from `--stdin`) | timestamp
-- | --
mysql-db1 | 2021-02-28 02:49:08
mysql-db2 | 2021-02-28 02:49:06
mysql-db3 | 2021-02-28 02:49:03
Real scenarios I'd like to implement with snapshots:
1. prune all snapshots, except last N days, based on dates without times (ex: I have multiple snapshots per day with multiple prefixes/suffixes, and I want to save all snapshots in this saved days, not the last snapshot from this day, so all snapshot from 2021-01-18 must stay, not the last one)
2. prune with some --weekly --days etc rules snapshot only with comment containing './dir1'
3. prune with some --weekly --days etc rules only snapshot with some suffix and/or prefix
4. combination of all above
Are any better ways then `borg prune --dry-run ... | grep ... | xargs borg delete` for scenario 2 and 3 and do manual delete in some script based on `borg list` for the first scenario ?
Contributor guide
Assessment
This issue has not been assessed yet.