#tool #cargo #clean #cache #cli

app cargocleaner

Runs cargo clean on all subdirectories

7 releases

✓ Uses Rust 2018 edition

0.9.6 Dec 8, 2019
0.9.5 Dec 8, 2019
0.9.4 Oct 18, 2019
0.9.2 Sep 26, 2019

#78 in Development tools

Download history 36/week @ 2019-12-02 102/week @ 2019-12-09 7/week @ 2019-12-23 2/week @ 2019-12-30 8/week @ 2020-01-06 33/week @ 2020-01-13 32/week @ 2020-01-20 7/week @ 2020-02-10 26/week @ 2020-02-17 38/week @ 2020-02-24 1/week @ 2020-03-02 14/week @ 2020-03-09 8/week @ 2020-03-16

101 downloads per month

MIT license

7KB
96 lines

Cargo clean for all subdirectories

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.

It's the same as if you manually went through each folder and ran cargo clean manually.

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 cleaner example

Install

Cargo install

cargo install cargocleaner

Manually

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.

Limitations

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 should work fine with workspaces but if for some reason you have a file called Cargo.toml which is not in the root of a crate it might not continue down any subdirectories.

Tip

This program will invoke commands on your system. cargo clean does delete files, but there is no logic in this code can delete anything besides what cargo clean does. The source is very short so look through it before running it on your system if you're in doubt.

No runtime deps