Monitor directories for new files.
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| .gitignore | ||
| created-file-monitor.py | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| requirements.txt | ||
| test_created_file_monitor.py | ||
created-file-monitor
created-file-monitor - Monitor directories for new files.
created-file-monitor scans one or more directories and reports files present. It can optionally maintain state across runs and report only newly created files.
The original use case was a periodic process, run via cron, to scan /var/spool/nullmailer/failed for errors from the nullmailer system.
Usage
created-file-monitor [--state|-S FILE] DIRECTORY ...
Options
- --state FILE or -S FILE -- State file for tracking previously seen files across runs
- DIRECTORY -- One or more directories to monitor
Examples
created-file-monitor --state /var/cache/nullmailer-failed.dat /var/spool/nullmailer/failed
created-file-monitor --state ${XDG_STATE_HOME:-$HOME/.local/state}/created-file-monitor.dat /path/to/dir1 /path/to/dir2 ...
Requirements
- Python 3.x
- No external dependencies (uses only standard library)
Testing
A comprehensive test suite is provided using pytest. To run the tests:
pip install pytest
pytest test_created_file_monitor.py -v
Author
Courtney Rosenthal <cr@crosenthal.com>
License
This is free and unencumbered software released into the public domain.
See LICENSE for details.