A utility to watch and organize folders inspired by Hazel for MacOS.
This pre-alpha application is in active development and is not functional yet, let alone useful for anyone. Some of the info in the README is aspirational and not completed. No guarantees.
- Create a
jobs.yamlfile - Define a list of jobs in a yaml file
jobs: - name: Sort Documents source: "~/Documents" destination: "~/Backup" pattern: "/{month:created}/{day:created}" recursive: false
- Run job:
hazel-rs --config jobs.yaml
Jobs contain patterns that tell the application how the items within the source directory should be organized. The pattern is the parsed, the variables replaced and then the resulting string is appended to the source or destination directory, if one is provided.
For example, this pattern sorts a directory into subdirectories by the month and year created:
{month:created}/{year:created} => 2023/03/<item>
{kind}/{days[30,60,90]:created} days => audio/{30,60,90} days/<item>
Variables are used to inject information from the current item into the path. If an item does not provide information for that variable, it is ignored.
Variables can be defined in the pattern in the following structure:
{token:specifier[thresholds]:modifer}
tokenis the field data you want to insertspecifieris the specific type of date to accessthresholdsenable grouping by the specifiermodifierchanges the output of the token
For tokens that have thresholds, the items in the source directory will be grouped by those amounts.
For example..
Organize by the number of days since file or directory creation:
/{month[30,60,90]:created} days => /{30,60,90} days/<item>
Organize by file size:
{kind}/{size[500M, 1G, 10G]} => video/{500M,1G,10G}/<item>
That will create a folder for each threshold and put the items into the appropriate directory.
Note: These ultimately translate to >=30 || >=60 || >=90 so anything that isn't the same over over the lowest threshold is ignored and
antyhing over the largest threshold is moved to that folder.
month[thresholds](number or name)createdaccessedmodified
day[thresholds](number or name)createdaccessedmodified
year[thresholds]createdaccessedmodified
size(files only)kind(application,image,video,etc., files only)mime(organized intotype/subtypefolders, files only)type(only include type)subtype(only include subtype)
extension(file extension)