makeclean
Removes generated and downloaded files from code projects to free up space.
Currently supports the following build tools:
- Cargo
- Elm
- Gradle
- Maven
- Mix
- NPM
Table of contents:
Installation
makeclean should work on Linux, MacOS and Windows. Only tested on Linux and Mac though.
Install using Cargo:
Usage
Run makeclean --help to see all available options.
List projects
List all projects that are "stale", that is, have not been changed recently, under a given path, using --list/-l:
By default, a project is considered stale if there weren't any changed for at least a month. You can change this by using --min-stale/-m; for example, to consider all projects that have not been modified within the last 2 weeks:
Set --min-stale to zero to disable the check:
You can also filter by build tool using --type/-t:
Clean projects
By default, makeclean looks for any projects that haven't been touched for a month, and offers to clean them:
Use --dry-run/-n to see what would happen, without actually deleting anything:
If you run makeclean in a script and don't want the prompt, you can pass --yes to proceed automatically:
Clean + archive projects
If you also want to archive the projects after cleaning them up, pass --archive. For example, the following command would replace the contents of ~/projects/foo with ~/projects/foo.tar.xz, after cleaning it:
Note that while
--archivealso considers cleaned projects, it still respects--min-stale. If makeclean doesn't find your project but you think it should, try again with the environment variableRUST_LOGset totrace, e.g.,RUST_LOG=trace makeclean --archive ~/projects/foo. You should see a hint as to why the project was not considered. If the logs don't tell you what's going on, please consider creating a GitHub issue.
To restore the project, use tar (which is probably already installed on your system):
&&
Use case: automatically run for multiple project directories
Let's say you have a list of directories where you know you'll create a lot of one-off projects you don't need to keep around in a ready state. You can use the following command to automically process them:
Limitations
makeclean only supports UTF-8 encoded paths.
Hack it
Check out the documentation on crates.io. PRs welcome!
License
MIT. Any contributions are assumed MIT-licensed as well.