A Windows system tray application that automatically monitors a directory and renames invoice files using a configurable date format based on the current date.
- Automatic monitoring: Watches a specific directory for new files
- Configurable date format: Customize the file naming pattern (e.g.,
2025-10.pdf,2025-10-19.pdf) - System tray icon: Runs in the background with visual status indicators
- Auto-start: Option to run on Windows startup
- Lightweight and efficient: Minimal system resource usage
- Rust - Core programming language
- winit - Event loop and system event handling
- tray-icon - System tray icon management
- notify - File system monitoring
- chrono - Date manipulation and formatting
- Windows 10 or higher
- No external dependencies required
# Clone the repository
git clone <repository-url>
cd invoices-name
# Build in release mode
cargo build --release
# The executable will be located at: target/release/autodate.exeThe application requires a .env file in the same directory as the executable with the following environment variables:
Create a .env file with the following configuration:
# Required: Directory path to monitor for new files
WATCH_PATH=C:\\Users\\YourUser\\Documents\\Invoices
# Required: Date format for renaming files (uses chrono format specifiers)
# Examples:
# %Y-%m -> 2025-10
# %Y-%m-%d -> 2025-10-19
# %Y%m%d -> 20251019
FILE_FORMAT=%Y-%m
# Required: Regex pattern to validate if a file already has a valid date in its name
# Files matching this pattern will be skipped (not renamed)
# Examples:
# ^\d{4}-(0[1-9]|1[0-2])$ -> Matches YYYY-MM format (2025-10)
# ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$ -> Matches YYYY-MM-DD format
# ^\d{8}$ -> Matches YYYYMMDD format (20251019)
# Note: Do not use quotes around the regex pattern
DATE_VALIDATION=^\d{4}-(0[1-9]|1[0-2])$
# Required: Delay in seconds before renaming a file (allows file to finish writing)
DELAY_SECONDS=5Common chrono format specifiers for FILE_FORMAT:
%Y- Year with 4 digits (e.g., 2025)%m- Month as a zero-padded number (01-12)%d- Day as a zero-padded number (01-31)%H- Hour in 24h format (00-23)%M- Minute (00-59)
For more format options, see the chrono documentation.
- Create a
.envfile with the required configuration - Run
autodate.exe - The application will appear in the system tray
- Right-click the icon to access the menu:
- Open folder: Opens the monitored directory
- Start with Windows: Enable/disable automatic startup
- Exit: Close the application
- Green: Application is running correctly
- Red: Monitoring or configuration error
# Run in debug mode (with console)
cargo run
# Run in release mode (without console)
cargo run --release
# Clean build artifacts
cargo cleanThis project is licensed under the MIT License - see the LICENSE file for details.