A cargo subcommand for cleaning up unused build files generated by Cargo.
Ideally you want: * Caching of recent artifacts for fast build times * Limited target size so that CI caches (on Travis etc.) are fast * An easy way of maintaining one or more projects at the same time
Cargo-sweep aims to solve all these issues for which a simple cargo clean is not sufficient.
To install run:
cargo install cargo-sweep
To clean all build files older than 30 days in the local cargo project run:
cargo sweep -t 30
To preview the results of a sweep run, which is recommended as a first step, add the -d
flag, for instance:
cargo sweep -d -t 30
You can also specify a path instead of defaulting to the current directory:
cargo sweep -t 30 <path>
To clean everything but the latest build you will need to run it in several steps.
DEPRICATED This behavior can be too agressive, since cargo can skip reading files when building a near-identical build, see #2 and #11. Also, this will be replaced once build-plan
is stabilized in cargo.
``` cargo sweep -s
cargo sweep -f
```
The first step generates a timestamp file which will be used to clean everything that was not used between it and the next time the file (-f) option is used. Finally, you can recursively clean all cargo project below a given path by adding the For more information run: Cargo-sweep is distributed under the terms the MIT license. See LICENSE for details.-r
flag, for instance:
cargo sweep -r -t 30 code/github.com/holmgr/
cargo sweep -h
License