Watch Folder Guide¶
The watch folder feature automatically monitors a directory for new files and processes them with OCR, making them searchable in Readur. Your original files are never modified or deleted - Readur simply copies and processes them while leaving the originals untouched.
What is Watch Folder?¶
Watch folder allows you to: - Drop files anywhere - Point Readur to any folder (local, network drive, cloud mount) - Automatic processing - New files are automatically detected and processed - Non-destructive - Original files remain exactly where you put them - Background operation - Processing happens in the background while you continue working
Perfect for scenarios where you want to automatically process files from: - Network drives (NFS, SMB shares) - Cloud storage mounts (Google Drive, Dropbox, OneDrive) - Local folders where you save scanned documents - Shared team folders
How It Works¶
- Point Readur to your folder - Set the
WATCH_FOLDERpath to any directory you want monitored - Drop files - Add documents to that folder (PDFs, images, text files, Word docs)
- Automatic detection - Readur notices new files within seconds (local) or minutes (network)
- OCR processing - Files are automatically processed to extract searchable text
- Search and find - Your documents become searchable in the Readur web interface
Documents imported from the watch folder belong to the admin account named by ADMIN_USERNAME (default admin), the account Readur creates on first start. If no account with that name exists, or it is not an admin, the files are skipped and an error is logged; they are picked up after the account exists once they change or the watcher restarts. Files in per-user watch directories belong to the directory's user.
Key Features¶
✅ Works with any storage type - Local drives, network shares, cloud mounts
✅ Smart processing - Only processes supported file types
✅ Duplicate prevention - Won't process the same file twice
✅ Safe operation - Never modifies or deletes your original files
✅ Background processing - Doesn't interrupt your workflow
Quick Setup¶
Basic Setup (Docker Compose)¶
-
Edit your docker-compose.yml:
-
Start Readur:
-
Start dropping files into
/path/to/your/documents- they'll be automatically processed!
Configuration Options¶
| Setting | Default | What it does |
|---|---|---|
WATCH_FOLDER | ./watch | Which folder to monitor |
WATCH_INTERVAL_SECONDS | 30 | Minimum interval between re-processing the same file; also controls polling frequency for network filesystems |
MAX_FILE_AGE_HOURS | (none) | Ignore files older than this |
ALLOWED_FILE_TYPES | pdf,png,jpg,jpeg,tiff,bmp,txt,doc,docx | Which file types to process |
Usage¶
Basic Setup¶
-
Set the watch folder path:
-
Start the application:
-
Copy files to the watch folder: The application will automatically detect and process new files.
Docker Usage¶
# Mount your folder to the container's watch directory
docker run -d \
-v /path/to/your/files:/app/watch \
-e WATCH_FOLDER=/app/watch \
-e WATCH_INTERVAL_SECONDS=60 \
readur:latest
Docker Compose¶
services:
readur:
image: ghcr.io/readur/readur:main
volumes:
- /mnt/nfs/documents:/app/watch
- readur_uploads:/app/uploads
environment:
WATCH_FOLDER: /app/watch
WATCH_INTERVAL_SECONDS: 30
FILE_STABILITY_CHECK_MS: 1000
MAX_FILE_AGE_HOURS: 168 # 1 week
ports:
- "8000:8000"
Filesystem-Specific Configuration¶
NFS Mounts¶
# Recommended settings for NFS
export WATCH_INTERVAL_SECONDS=60
export FILE_STABILITY_CHECK_MS=1000
export FORCE_POLLING_WATCH=1
SMB/CIFS Mounts¶
S3 Mounts (s3fs, goofys, etc.)¶
# Recommended settings for S3
export WATCH_INTERVAL_SECONDS=120
export FILE_STABILITY_CHECK_MS=5000
export FORCE_POLLING_WATCH=1
Local Filesystems¶
# Uses inotify automatically for instant file detection.
# WATCH_INTERVAL_SECONDS controls debounce (minimum time before
# re-processing the same file). Default 30s is suitable for most setups.
Supported File Types¶
The watch folder processes these file types for OCR:
- PDF:
*.pdf - Images:
*.png,*.jpg,*.jpeg,*.tiff,*.bmp,*.gif - Text:
*.txt - Word Documents:
*.doc,*.docx
File Processing Priority¶
Files are prioritized for OCR processing based on:
- File Size: Smaller files get higher priority
- File Type: Images > Text files > PDFs > Word documents
- Queue Time: Older items get higher priority within the same size/type category
Monitoring and Logs¶
The application provides detailed logging for watch folder operations:
INFO readur::watcher: Starting hybrid folder watcher on: /app/watch
INFO readur::watcher: Using watch strategy: Hybrid
INFO readur::watcher: Started polling-based watcher on: /app/watch
INFO readur::watcher: Processing new file: "/app/watch/document.pdf"
INFO readur::watcher: Successfully queued file for OCR: document.pdf (size: 2048 bytes)
Troubleshooting¶
Files Not Being Detected¶
-
Check permissions:
-
Verify file types:
-
Check file stability:
High CPU Usage¶
-
Increase polling interval:
-
Limit file age:
Network Mount Issues¶
-
Force polling mode:
-
Increase stability check:
Testing¶
Use the provided test script to verify functionality:
This creates sample files in the watch folder for testing.
Security Considerations¶
- Files are copied to a secure upload directory, not processed in-place
- Original files in the watch folder are never modified or deleted
- System files and hidden files are automatically excluded
- File size limits prevent processing of excessively large files (>500MB)
Performance¶
- Local filesystems: Near-instant detection via inotify
- Network filesystems: Detection within polling interval (default 30s)
- Concurrent processing: Multiple files processed simultaneously
- Memory efficient: Streams large files without loading entirely into memory
Examples¶
Basic File Drop¶
# Copy a file to the watch folder
cp document.pdf /app/watch/
# File will be automatically detected and processed