This chapter covers the core features and capabilities of File Watcher.
*.py, *.csv, data/*.json, etc.Follow this guide to get File Watcher up and running in your environment.
# Watch a directory and run tests on Python file changes
python src/file_watcher.py --watch ./src --pattern "*.py" --command "python -m pytest"
# Watch for CSV changes and hit a webhook
python src/file_watcher.py --watch ./data --pattern "*.csv" \
--webhook https://api.example.com/v1/reload
# Use a config file for complex setups
python src/file_watcher.py --config examples/watcher_config.json
# Watch with content-aware checksums (detects real content changes, not just timestamps)
python src/file_watcher.py --watch ./src --pattern "*.py" --checksums --command "make build"{
"rules": [
{
"name": "python-tests",
"watch_path": "./src",
"patterns": ["*.py"],
"recursive": true,
"actions": [
{"type": "command", "command": "python -m pytest tests/"},
{"type": "log"}
]
},
{
"name": "data-reload",
"watch_path": "./data",
"patterns": ["*.csv", "*.json"],
"recursive": false,
"actions": [
{"type": "webhook", "url": "https://api.example.com/v1/reload"},
{"type": "command", "command": "python scripts/validate_data.py"}
]
}
],
"poll_interval": 2.0,
"debounce": 0.5,
"use_checksums": true
}| Flag | Default | Description |
|---|---|---|
--config, -c | — | Watcher config file (JSON) |
--watch, -w | — | Directory to watch |
--pattern, -p | * | Glob pattern to match |
--command | — | Shell command to run on file change |
--webhook | — | Webhook URL to notify on file change |
--poll-interval | 2.0 | Seconds between filesystem scans |
--recursive | true | Watch subdirectories |
--no-recursive | — | Disable recursive watching |
--checksums | false | Use MD5 checksums for change detection |
--log-level | INFO | Logging level |
| Type | Description | Config Fields |
|---|---|---|
command | Run a shell command | command (string) |
webhook | POST to a URL | url (string) |
log | Write structured log entry | — |
Get the full File Watcher and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.