Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sweep

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.


Features

  • 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

Example

Before running Sweep:

/downloads
├── report.pdf
├── image.jpg
├── notes.txt
├── video.mp4

After running Sweep:

/downloads
├── Documents
│   ├── report.pdf
│   └── notes.txt
├── Images
│   └── image.jpg
├── Videos
│   └── video.mp4
└── Others

Installation

Prerequisites

  • Rust 1.70+
  • Cargo

Install Rust from: https://www.rust-lang.org/tools/install


Install locally (recommended)

From the project root:

cargo install --path .

Make sure Cargo’s bin directory is in your PATH:

export PATH="$HOME/.cargo/bin:$PATH"

Build manually

cargo build --release

Binary output:

target/release/sweep

You can run it directly:

./target/release/sweep /path/to/directory

Usage

sweep <DIRECTORY>

Example

sweep ~/Downloads

Sweep will move files inside the given directory into categorized folders.


Configuration

Sweep uses a categories.toml file to define how files are grouped.

Example categories.toml

[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"]

Notes

  • Extensions are case-insensitive
  • Files with unknown extensions are moved to Others
  • Files without extensions are ignored

How It Works

  • 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

Limitations

  • Does not recurse into subdirectories
  • Files with the same name may overwrite existing files
  • Configuration is currently embedded at compile time (include_str!)

About

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.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages