Crates.io | dateframe |
lib.rs | dateframe |
version | 0.2.4 |
source | src |
created_at | 2024-02-21 18:12:19.627494 |
updated_at | 2024-03-07 05:19:17.025408 |
description | Clean up files & folders |
homepage | |
repository | |
max_upload_size | |
id | 1148338 |
size | 29,063 |
Clean up folders & files!
Dateframe is meant to keep a running collection of folders. The reason I created it is I copy security camera footage from my security system to my NAS, but I don't want to keep copies for all time. This will allow me to scrub extraneous footage automatically.
dateframe.conf
in the root of the folder you want to maintain (see documentation below).docker run -v /your/path/here:/var/data -d --name dateframe ghcr.io/jacksonzamorano/dateframe:latest
dateframe.conf
in the root of the folder you want to maintain (see documentation below).cargo install dateframe
.dateframe path/to/your/directory
.--gen-test
: Generates a structure of test files.--once
: Runs once, and does not start a daemon.Configuration is provided in the format key=value (without spaces). Note all times are parsed and formatted in your machine's local time.
format
Format specifies how dates from file/foldernames should be parsed. The format is provided by the chrono
crate, check out the documentation here. Multiple formats can be provided, and all will be tried on each file.
retention
Retention specifies how long folders & files should stay. Here are the following formats:
xxd
(replacing xx with number of days)deep
Defaults to true
. Can be true
or false
. If true
, folders are recursively searched instead of just cleaning the root directory.
refresh
Number specified in seconds. After cleaning, this number specifies how long dateframe should sleep before cleaning again. Default is 360 (1 hour).
log
Defines how much information will go to the console. They are listed in most verbose to least:
debug
info
error
silent
Default is info.
remove
Specific words/items to be removed. Multiple copies of this key can be provided and all will be used.
split_string
For more complicated filenames, you may want to split on a specific string or character. For example, consider this filename: "2024-02-21T04-23-57 smartDetectZone (person)". We could add "smartDetectZone" and "(person)" to the remove
key but it would instead me easier to split on a string and use the first element.
So, set split_string
to an empty space split_string=
.
split_index
After a split_string
is provided and executed, select which indicies to be used. Multiple copies of this key can be provided and all will be used.
split_join
After a split_string
is performed and the proper selections are found, the selected strings are joined using this value. Default is "" (blank string).
date_only_behavior
If only a date format is used (for example YYYY-mm-DD), a time needs to be added to determine if the date is past the retention policy. There are several options:
start
: 00:00:00noon
: 12:00:00end
: 23:59:59h[x]
: x:00:00The default is start
.