A fast, flexible, and safe command-line tool built in Rust to automatically organize messy folders into structured directories using customizable rules.
Most people’s Downloads folder is chaos — images, PDFs, videos, code files all mixed together.
This tool solves that problem by:
- Scanning your folders automatically
- Applying smart, customizable rules
- Organizing files into clean, structured directories
- Doing it safely with preview (dry-run) support
- ✅ Recursive file scanning
- ✅ Rule-based file organization (via TOML config)
- ✅ Dry-run mode (preview before moving files)
- ✅ Safe file handling (no overwrites)
- ✅ Progress bar for real-time feedback
- ✅ Cross-platform support (Linux, macOS, Windows)
- ✅ Clean error handling (no crashes)
- You provide a folder (e.g., Downloads)
- The tool scans all files recursively
- It applies rules defined in a config file
- Files are moved into categorized folders
# Preview (safe mode)
smart-organizer ~/Downloads --dry-run
# With custom config
smart-organizer ~/Downloads --config config.toml
# Actual execution
smart-organizer ~/DownloadsCreate a config.toml file:
[[rules]]
name = "Images"
extensions = ["jpg", "png", "jpeg"]
destination = "Images"
[[rules]]
name = "Documents"
extensions = ["pdf", "docx", "txt"]
destination = "Documents"
[[rules]]
name = "Reports"
extension = "csv"
starts_with = "report_"
destination = "Data"smart-organizer ~/Downloads --dry-runOutput:
[DRY RUN] photo.jpg → Images/
[DRY RUN] report_2024.csv → Data/
✅ Moved → Downloads/Images/photo.jpg
✅ Moved → Downloads/Documents/file.pdf
⚠️ Skipped (already exists)
src/
├── main.rs # Entry point
├── cli.rs # CLI argument parsing
├── scanner.rs # File scanning logic
├── config.rs # Config loader (TOML)
├── rules.rs # Rule engine (core logic)
├── mover.rs # File moving logic
├── progress.rs # Progress bar UI
- Rust 🦀
- clap — CLI parsing
- walkdir — directory traversal
- serde + toml — config parsing
- anyhow — error handling
- dirs — system config paths
- indicatif — progress bar
- ✔ Dry-run mode (preview before execution)
- ✔ No file overwrite (skips duplicates)
- ✔ Graceful error handling
- ✔ Controlled file movement
cargo build --releaseRun:
./target/release/smart-file-organizer ~/DownloadsBuilt by Basant Singh using Rust to solve a real-world problem.
If you like this project, consider giving it a ⭐ on GitHub!



