Mass delete your cached files!

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.

4 Likes

yesss!!!

you could probably add a “just for you!” or something, anyways thanks for the tool


it’s just a funny timing, today I was just thinking about making the same thing

I’m far from the first person solving this exact problem lol.
When writing the title of this post discourse identified this post form a couple of months ago as being similar to mine.

Not sure what you mead by this?

your post looks like a commercial ad, so “[product name] is the solution just for you!” is a funny stretch

Ah damn, now I wish I committed to the bit more!

one step closer to having a marketing department for Zig!

1 Like

I’m going to need some informercial vid now