Go to file
Mathias Rothenhaeusler ce32b43ba6 Added README.md 2026-04-12 13:10:32 +02:00
src cargo cleanup tool (plugin) 2026-04-12 13:01:48 +02:00
tests/data cargo cleanup tool (plugin) 2026-04-12 13:01:48 +02:00
.gitignore cargo cleanup tool (plugin) 2026-04-12 13:01:48 +02:00
Cargo.lock cargo cleanup tool (plugin) 2026-04-12 13:01:48 +02:00
Cargo.toml cargo cleanup tool (plugin) 2026-04-12 13:01:48 +02:00
README.md Added README.md 2026-04-12 13:10:32 +02:00

README.md

cargo-cleanup

A fast, recursive cargo clean tool for saving disk space across multiple Rust projects.


Overview

cargo-cleanup is a Cargo subcommand that recursively cleans build artifacts from Rust projects, helping you reclaim disk space. Instead of running cargo clean in each project manually, you can clean entire directory trees in a single command.


Features

  • Recursive cleaning: Clean build artifacts across all Cargo projects in a directory tree
  • Dry-run mode: Preview what would be deleted without actually removing files
  • Simple CLI: Intuitive subcommand interface integrated with Cargo
  • Multi-path support: Clean multiple directories in one command

Installation

Add this to your Cargo.toml:

[dependencies]
# or install with: cargo install cargo-cleanup

Or install directly from source:

cargo install --path .

Usage

Basic usage

Clean the current directory and all subdirectories:

cargo slim

Clean specific directories

cargo slim path/to/project1 path/to/project2

Preview changes with dry-run

cargo slim --dry-run

Get help

cargo slim --help

How it works

cargo-cleanup recursively searches for Cargo.toml files in the specified paths (or current directory by default) and runs cargo clean in each project found. This removes target/ directories and other build artifacts, freeing up disk space.


Examples

# Clean current project and any nested workspaces
cargo slim

# Clean your entire ~/projects directory
cargo slim ~/projects

# See what would be deleted without actually deleting
cargo slim ~/projects --dry-run

# Clean multiple locations at once
cargo slim ~/work ~/hobby-projects

License

MIT