Folder Actions is a script which executes actions for files in a specific folder (like your downloads folder) and is able to move and sort them based on defined rules.
Each rule is a Python script defining a Rule
class which then does whatever you want it to do.
At the heart, it uses watchdog to observe the specified directory and wait for events. Once a new file has been saved into the watched directory, the configured rules will be checked. If a rule matches, the rule will be executed for that file.
- Clone this repository into any directory
- Install the requirements using pip:
pip install -r requirements.txt
- Define your rules (see bellow)
- Execute
folder-actions.py watch /path/to/watch
The main configuration is done using a file in YAML format. The configuration should be stored at ~/.config/folder-actions/config.yml
.
Take a look at the example config.yml.
The script looks into ~/.config/folder-actions/rules
and loads any Python script. Each script should contain a Rule
class containing at least a get_rules()
method returning a list of paths to match.
Take a look into the examples folder for some example rule files as well as the Rule class structure.