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.
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
You can have more than one [[processors]]
sections.
Options:
depth
is a recursion depth of sub-directories to watch. Defaults to 0, meaning watching only the parent directory itself. nfp
will automatically pick up changes in the directory tree.
keep_file
prevents automatic deletion of a processed file.
debounce
is useful for producers with a habit of re-opening and overwriting files several times in quick succession. This specifies a timeout in milliseconds to wait after the file was last written and closed before calling a processing command on it.
The config file is looked up in nfp/config.toml
under the common config directory on you platform (using directories
crate to resolve that.)
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.