Crates.io | backedup |
lib.rs | backedup |
version | 0.1.1 |
source | src |
created_at | 2021-04-10 18:33:40.498881 |
updated_at | 2021-04-12 19:47:38.434539 |
description | A command line util for backup rotation |
homepage | |
repository | https://github.com/bonega/backedup |
max_upload_size | |
id | 381758 |
size | 38,235 |
A command line util for backup rotation.
Uses filenames to extract timestamps and then sort files into timeslots for retention or deletion.
cargo install backedup
A local clone can be built from source and installed with:
cargo install .
By default, the plan will be displayed. Removal only happens if the --execute
flag is given.
Filenames from a given directory are parsed into a time representation.
At least year
, month
and day
have to present to be considered for removal. A configuration of how many files to
keep in each slot have to be provided for at least one slot.
The following command will display a plan to keep:
backedup -y 20 -m 12 -d 30 path/to/directory
Files are grouped into separate slots only by time, rest of filename is never considered.
Use --pattern
or -p
flag if only a specific filename pattern should be accepted.
For example: --pattern '*.log'
.
An alternative regex for parsing time from filenames can be provided by --regex
. The default is
(?P<year>\d{4}) \D?
(?P<month>\d{2}) \D?
(?P<day>\d{2}) \D?
(
# Optional components.
(?P<hour>\d{2}) \D?
(?P<minute>\d{2}) \D?
(?P<second>\d{2})?
)?
See --help
for more details or look at
the example config
By default, file deletion is logged to Syslog
Regex and general inspiration is taken from python-rotate-backups