cargocleaner
simply walks all subdirectories from the current path it's called
from and if it finds a Cargo.toml
document it runs the command cargo clean
.
This can save huge amounts of space if you have many projects. One one of my folders it went from 20 GB to 800 MB.
cargo install cargocleaner
Clone this repository.
Run cargo install --path ./
.
You should now be able to simply call ./cargocleaner
in a directory that
contains one or more Cargo projects and let it run.
Currently it only works on macos
and presumably linux
but it's trivial
to make it work on Windows as well I just haven't needed it.
Right now this is just a very simple tool but since we don't go through sub folders
if we find a Cargo.toml
in the root this might not work fully on workspaces
or
other places where you have several cargo crates nested.
This program will invoke commands on your system and cargo clean
does delete files.
There is no logic in this code that deletes any thing. The source is very short so look
through it before running it on your system.