Skip to content
/ hazel-rs Public

Attempting to bring some of the features of Hazel on Mac to Linux (and beyond)

Notifications You must be signed in to change notification settings

iamdb/hazel-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hazel-rs

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.

Getting started

  • Create a jobs.yaml file
  • 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

Renaming Patterns

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

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}

  • token is the field data you want to insert
  • specifier is the specific type of date to access
  • thresholds enable grouping by the specifier
  • modifier changes the output of the token

Thresholds

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.

List of Tokens and Specifiers

  • month[thresholds] (number or name)
    • created
    • accessed
    • modified
  • day[thresholds] (number or name)
    • created
    • accessed
    • modified
  • year[thresholds]
    • created
    • accessed
    • modified
  • size (files only)
  • kind (application,image,video,etc., files only)
  • mime (organized into type/subtype folders, files only)
    • type (only include type)
    • subtype (only include subtype)
  • extension (file extension)

About

Attempting to bring some of the features of Hazel on Mac to Linux (and beyond)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages