https://github.com/basantsd/smart-file-organizer-cli
A fast, flexible, and safe command-line tool built in Rust to automatically organize messy folders into structured directories using customizable rules.
https://github.com/basantsd/smart-file-organizer-cli
anyhow cargo clap-rs directory indicatif rust serde toml
Last synced: about 2 months ago
JSON representation
A fast, flexible, and safe command-line tool built in Rust to automatically organize messy folders into structured directories using customizable rules.
- Host: GitHub
- URL: https://github.com/basantsd/smart-file-organizer-cli
- Owner: basantsd
- Created: 2026-04-26T01:49:35.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2026-04-26T06:28:21.000Z (about 2 months ago)
- Last Synced: 2026-04-26T07:22:08.389Z (about 2 months ago)
- Topics: anyhow, cargo, clap-rs, directory, indicatif, rust, serde, toml
- Language: Rust
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Smart File Organizer CLI (Rust)

## πΈ Demo
### Before: Unorganized Files

### Checking Dry Run

### Moving Files

### After: Organized Files

A fast, flexible, and safe command-line tool built in Rust to automatically organize messy folders into structured directories using customizable rules.
---
## Why This Project?
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
---
## Features
* β
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)
---
## How It Works
1. You provide a folder (e.g., Downloads)
2. The tool scans all files recursively
3. It applies rules defined in a config file
4. Files are moved into categorized folders
---
## Example Usage
```bash
# Preview (safe mode)
smart-organizer ~/Downloads --dry-run
# With custom config
smart-organizer ~/Downloads --config config.toml
# Actual execution
smart-organizer ~/Downloads
```
---
## Configuration (TOML)
Create a `config.toml` file:
```toml
[[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"
```
---
## π§ͺ Dry Run Example
```bash
smart-organizer ~/Downloads --dry-run
```
Output:
```
[DRY RUN] photo.jpg β Images/
[DRY RUN] report_2024.csv β Data/
```
---
## π Real Execution Example
```
β
Moved β Downloads/Images/photo.jpg
β
Moved β Downloads/Documents/file.pdf
β οΈ Skipped (already exists)
```
---
## Project Structure
```
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
```
---
## Tech Stack
* Rust π¦
* clap β CLI parsing
* walkdir β directory traversal
* serde + toml β config parsing
* anyhow β error handling
* dirs β system config paths
* indicatif β progress bar
---
## π‘οΈ Safety Features
* β Dry-run mode (preview before execution)
* β No file overwrite (skips duplicates)
* β Graceful error handling
* β Controlled file movement
---
## Installation
```bash
cargo build --release
```
Run:
```bash
./target/release/smart-file-organizer ~/Downloads
```
---
## π¨βπ» Author
Built by Basant Singh using Rust to solve a real-world problem.
---
## β Support
If you like this project, consider giving it a β on GitHub!