⚡ Easily remove compiled build artifacts from Rust, Go, Gradle, and Maven projects with a single command.
📘 Looking for Chinese docs? View 中文说明 🇨🇳
graph TD
A[rs_clean CLI] --> B{main.rs};
B --> C(Command Line Argument Parsing: clap);
C --> D(Initialize Cleaning Commands: constant.rs, utils.rs);
D -- Supported Commands --> E[lib.rs - do_clean_all];
E -- Recursive Scan --> F(walkdir);
F -- Project Identification & Task Generation --> G{cmd.rs - Cmd};
G -- Asynchronous Execution & Concurrency Control --> H(tokio, Semaphore, futures::join_all);
H -- Actual Cleaning Operation --> I(Cmd::run_clean);
I -- External Command Execution --> J(tokio::process::Command);
I -- node_modules Deletion --> K(tokio::fs::remove_dir_all);
E -- Result Statistics & Formatting --> L(get_dir_size_async, format_size);
L -- Progress Display & Final Report --> M(indicatif, colored);
$ rs_clean folder/🎯 Interactive Experience!
When you run rs_clean, it now shows you exactly what will be deleted and asks for confirmation:
$ rs_clean my_projects/
Scanning for projects to clean...
=== Deletion Preview ===
Found projects to clean:
1. my_projects/rust_app (cargo) - 156.2 MB
2. my_projects/go_service (go) - 45.8 MB
3. my_projects/gradle_app (gradle) - 89.1 MB
Total space to be freed: 291.1 MB
Select cleaning mode:
> Clean all projects
Select specific projects to clean
Review each project individually
Cancel operation- Arrow Keys: Navigate through options
- Enter: Confirm selection
- Space: Select/deselect items (in multi-select mode)
- ESC: Cancel operation
# Basic usage with interactive confirmation
$ rs_clean folder/
# Skip confirmation prompts (for automation)
$ rs_clean folder/ --no-confirm
# Preview what would be deleted without actually deleting
$ rs_clean folder/ --dry-run
# Exclude specific directories
$ rs_clean folder/ --exclude-dir node_modules --exclude-dir build
# Show detailed output
$ rs_clean folder/ --verbosecargo install rs_clean👉 Download from GitHub Releases Grab the latest binary for your operating system.
- ✅ Cleans Rust projects:
target/ - ✅ Cleans Go build output
- ✅ Cleans Gradle projects:
build/ - ✅ Cleans Maven projects:
target/ - ✅ Cleans Node.js projects:
node_modules/(by removingnode_modulesdirectory directly) - ✅ Cleans Python projects:
__pycache__/,venv/,.venv/,build/,dist/,.eggs/, etc. (by removing these directories directly) - ✅ Recursively scans subdirectories
- ✅ Automatically detects project type
- ✅ Efficient Parallel Processing: Utilizes asynchronous operations and CPU core awareness for fast, concurrent cleaning.
- ✅ Safety Mechanisms: Includes limits on directory depth and file count to prevent excessive resource consumption.
- ✅ Disk Space Reporting: Shows the total disk space freed after cleanup.
$ tree my_projects/
my_projects/
├── rust_app/
│ └── target/
├── go_service/
│ └── bin/
├── gradle_app/
│ └── build/
└── maven_module/
└── target/After running:
$ rs_clean my_projects/The build artifacts will be cleaned:
$ tree my_projects/
my_projects/
├── rust_app/
├── go_service/
├── gradle_app/
└── maven_module/- Free up disk space by removing large build folders.
- Ensure a clean build environment in CI/CD pipelines.
- Clean multiple types of projects in monorepos.
- Add interactive confirmation prompts
- More detailed disk space reporting per project
- Customizable exclusion lists for specific directories/files (partially implemented with
--exclude-dir)
We welcome contributions and feedback!
- Open an issue for bugs or suggestions
- Submit a pull request for enhancements
- Star ⭐ the repo if you find it helpful
MIT License © 2025 [coderpwh]