# 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:
```toml
[[processors]]
path = "/home/user/.local/share/nfp/export1"
command = "python"
args = ["/path/to/upload.py"]
debounce = 500
```
You can have more than one `[[processors]]` sections.
The `debounce` attribute is for programs that have 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][d] to resolve that.)
[d]: https://docs.rs/directories/4.0.1/directories/struct.BaseDirs.html#method.config_dir
## Runnning
In the simplest case it's just:
```sh
nfp
```
You probably want to run that on start-up and redirect stdout/stderr somewhere sensible.
```sh
nfp >> ~/.local/state/nfp/log 2>&1
```
You could also just run it via `nohup` and simply close the terminal window after that.