Sweep is a simple and fast command-line tool written in Rust that automatically organizes files in a directory into categorized folders based on file extensions.
It is ideal for cleaning up directories such as Downloads, Desktop, or any folder that accumulates mixed file types.
- Organizes files by extension into predefined categories
- Fully configurable via
categories.toml - Creates target folders automatically
- Safe: ignores directories and files without extensions
- Fast and portable single-binary CLI
Before running Sweep:
/downloads
├── report.pdf
├── image.jpg
├── notes.txt
├── video.mp4After running Sweep:
/downloads
├── Documents
│ ├── report.pdf
│ └── notes.txt
├── Images
│ └── image.jpg
├── Videos
│ └── video.mp4
└── Others- Rust 1.70+
- Cargo
Install Rust from: https://www.rust-lang.org/tools/install
From the project root:
cargo install --path .Make sure Cargo’s bin directory is in your PATH:
export PATH="$HOME/.cargo/bin:$PATH"cargo build --releaseBinary output:
target/release/sweepYou can run it directly:
./target/release/sweep /path/to/directorysweep <DIRECTORY>Example
sweep ~/DownloadsSweep will move files inside the given directory into categorized folders.
Sweep uses a categories.toml file to define how files are grouped.
[categories.documents]
folder_name = "Documents"
extensions = ["pdf", "doc", "docx", "txt", "md"]
[categories.images]
folder_name = "Images"
extensions = ["jpg", "jpeg", "png", "gif", "webp"]
[categories.videos]
folder_name = "Videos"
extensions = ["mp4", "mkv", "avi"]
[categories.audio]
folder_name = "Audio"
extensions = ["mp3", "wav", "flac"]- Extensions are case-insensitive
- Files with unknown extensions are moved to Others
- Files without extensions are ignored
- Reads file entries from the target directory
- Extracts file extensions
- Matches extensions against configured categories
- Moves files into their corresponding folders
- Creates folders automatically if they don’t exist
- Does not recurse into subdirectories
- Files with the same name may overwrite existing files
- Configuration is currently embedded at compile time (
include_str!)