README.md

New File Processor

nfp is a tool that watches directories for new files and calls user-defined commands on them. Like automatically calling an upload script on a file exported from a graphics editor to a specified directory.

Config

nfp is configured by a TOML file like this:

[[processors]]
path = "/home/user/.local/share/nfp/export1"
depth = 1
command = "python"
args = ["/path/to/upload.py", "%f"]  # %f is replaced with a filename
keep_file = true
debounce = 500

The easiest way to create or edit the config is to run nfp -e. It will provide a commented example if the config is not present.

The config file is looked up in nfp/config.toml under the common config directory on you platform (using directories crate to resolve that.)

A running nfp daemon will automatically pick up changes to the config. If the config is broken and unparsable, the daemon will continue to use its current configuration and watching for further config changes.

Runnning

In the simplest case it's just:

nfp

You probably want to run that on start-up and redirect stdout/stderr somewhere sensible.

nfp >> ~/.local/state/nfp/log 2>&1

You could also just run it via nohup and simply close the terminal window after that.