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:
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.
Oh, this is most definitely a “my system only” script, I am not recommending anyone use it. The point was to show what a terrible method that I have been using, not sharing a script for others to use.