Remove unneeded historical files
You may have backups.
Every day, your precious stuff is saved in a safe place.
But you may have too much of that…
This script will select for you what files to drop, based on a retention policy such that as files get older you can keep less of them. The default policy will keep all the files in the last two weeks, a file every week for the last three months, a file every month for the last year, a file every year forever.
The script takes in input the existing files on command line and by default will print on stdout the files to delete. You can use a chain of commands such as:
ls | xargs weeder | xargs rm
to run in a cron job every day to keep your backup directories light.
Our glorious help
Running weeder -h you might be told:
usage: weeder [-h] [-p AGE:DIST [AGE:DIST ...]] [-f REGEX] [-r YYYY-MM-DD]
[--print-keepers | --print-goners] [-q | -v]
[FILE [FILE ...]]
positional arguments:
FILE the files to weed
optional arguments:
-h, --help show this help message and exit
-p AGE:DIST [AGE:DIST ...], --policy AGE:DIST [AGE:DIST ...]
state that, of every file older than AGE days, we want
to keep at least one every DIST days
[default: 14:7 84:28 364:364]
-f REGEX, --format REGEX
the pattern to extract a date from a file name
[default: (\d{4})-(\d{2})-(\d{2})]
-r YYYY-MM-DD, --refdate YYYY-MM-DD
reference date to establish retention [default: today]
--print-keepers print the files to keep
--print-goners print the files to delete [default]
-q, --quiet talk less
-v, --verbose talk more
but who knows, really.
Running tests
You can run:
python3 setup.py test
Metadata
Release files for weeder 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| weeder-0.1.tar.gz | 4.3 kB | Without provenance | Details for weeder-0.1.tar.gz |
Release files / weeder-0.1.tar.gz
| Download URL | weeder-0.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9eac17275982b9eb8aae2c731204105562d148cb60b2533d64e9893de1d4c27
|
|
BLAKE2b-256 checksum How to use checksums |
48f42876b1270b083b7ccad97be9c22ae0a81e8fcf1b25ca260db5b4de3c96b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7
|
Security for weeder 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.