| Crates.io | datefilter |
| lib.rs | datefilter |
| version | 0.1.6 |
| created_at | 2025-02-13 19:40:58.623142+00 |
| updated_at | 2025-02-13 19:49:46.051649+00 |
| description | Filter filenames on stdin to exclude filenames for dates which should be kept, and filenames not containing dates. |
| homepage | |
| repository | https://github.com/fadedbee/datefilter |
| max_upload_size | |
| id | 1554614 |
| size | 36,432 |
Filter filenames on stdin to exclude filenames for dates which should be kept, and filenames not containing dates.
This is intended to be part of a pipeline for removing old dated files or old ZFS snapshots.
$ ls *.backup | datefilter --days=31 --months=12 --years=10 | xargs rm
The pipeline above will delete all *.backup files which contain a YYYY-MM-DD substring in their filename, where that date is NOT:
All date-containing filenames, not matching the above criteria, will be written to stdout (and deleted by xargs/rm in the example above).
28 days, 12 months and 100 years.
Filenames containing newlines or other whitespace will not be processed correctly.