Compare commits
2 Commits
770cf5ea0e
...
ba7c2d4b71
| Author | SHA1 | Date | |
|---|---|---|---|
|
ba7c2d4b71
|
|||
|
3435f1d4e6
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -97,7 +97,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "file_reap"
|
name = "filereap"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "file_reap"
|
name = "filereap"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|||||||
34
README.md
34
README.md
@ -1,4 +1,36 @@
|
|||||||
# file_reap
|
# filereap
|
||||||
|
|
||||||
Delete dated files in a directory according to a time period config.
|
Delete dated files in a directory according to a time period config.
|
||||||
Useful for backup directories that accumulate files over time.
|
Useful for backup directories that accumulate files over time.
|
||||||
|
|
||||||
|
## Example config
|
||||||
|
```toml
|
||||||
|
# Specify a folder containing backups
|
||||||
|
path = "/backups/docker"
|
||||||
|
|
||||||
|
# uncomment if the backups are btrfs subvolumes
|
||||||
|
#btrfs = true
|
||||||
|
|
||||||
|
[[periods]]
|
||||||
|
# For the first day, keep one backup per second (basically, don't delete backups)
|
||||||
|
# syntax supports suffixes s, m, h, d, w
|
||||||
|
period_length = "1d"
|
||||||
|
chunk_size = "1s"
|
||||||
|
|
||||||
|
[[periods]]
|
||||||
|
# For the next week, keep one backup per hour
|
||||||
|
period_length = "1w"
|
||||||
|
chunk_size = "1h"
|
||||||
|
|
||||||
|
[[periods]]
|
||||||
|
# For the next 4 weeks, keep one backup per day
|
||||||
|
period_length = "4w"
|
||||||
|
chunk_size = "1d"
|
||||||
|
|
||||||
|
# can add more [[periods]] as needed
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example usage
|
||||||
|
```sh
|
||||||
|
filereap --help
|
||||||
|
```
|
||||||
|
|||||||
15
example.toml
15
example.toml
@ -1,18 +1,23 @@
|
|||||||
path = "./test"
|
# Specify a folder containing backups
|
||||||
|
path = "/backups/docker"
|
||||||
|
|
||||||
|
# uncomment if the backups are btrfs subvolumes
|
||||||
#btrfs = true
|
#btrfs = true
|
||||||
|
|
||||||
[[periods]]
|
[[periods]]
|
||||||
period_length = "10m"
|
# For the first day, keep one backup per second (basically, don't delete backups)
|
||||||
|
# syntax supports suffixes s, m, h, d, w
|
||||||
|
period_length = "1d"
|
||||||
chunk_size = "1s"
|
chunk_size = "1s"
|
||||||
|
|
||||||
[[periods]]
|
[[periods]]
|
||||||
|
# For the next week, keep one backup per hour
|
||||||
period_length = "1w"
|
period_length = "1w"
|
||||||
chunk_size = "1h"
|
chunk_size = "1h"
|
||||||
|
|
||||||
[[periods]]
|
[[periods]]
|
||||||
|
# For the next 4 weeks, keep one backup per day
|
||||||
period_length = "4w"
|
period_length = "4w"
|
||||||
chunk_size = "1d"
|
chunk_size = "1d"
|
||||||
|
|
||||||
[[periods]]
|
# can add more [[periods]] as needed
|
||||||
period_length = "40w"
|
|
||||||
chunk_size = "4w"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user