decache
Have you ever thought to yourself:
“Gosh dang it, all these .zig-cache directories are taking up so much space on my disk, but I have so many projects it would take AGES to clean them all up! What ever could I do?”
decache lets you easily clean up all directories that match a pattern, such as for example .zig-cache/o/. Filtering by minimum age is also supported, with more planned!
It was very enjoyable going through the process of seeing a problem I’m having to a full working solution. They weren’t lying when they said it feels great! I got to learn a little bit about how the filesystem works on linux, and a LOT about how various utilities format their --help messages and parse their arguments.
I’ve freed up over 120GB (!!!) of cached zig and rust files from my disk, which is a LOT given that my laptop has only 512GB of storage. I wish I had a screenshot to attach, but I sadly closed the terminal before I thought to take one :(
Examples
Delete all .zig-cache/ directories in the ~/Projects folder, and print how much space was freed:
decache --summary ~/Projects .zig-cache/
Delete all rust build outputs, and print what’s being deleted:
decache --verbose ~/Projects target/debug/ target/release/
Actually hold on a sec, make sure it IS only rust stuff that’s gonna be deleted:
decache --dry-run ~/Projects target/debug/ target/release/
Supported Zig versions
Built with zig 0.16.0.
Newer versions might also compile but are untested.