I just published zc, a small Zig utility to clean up .zig-cache directories recursively.
The main motivation was practical (Zig caches piling up across many repos), but I also used this project as a way to get more familiar with Zig’s new I/O interface and concurrency patterns. The tool walks the filesystem, queues work, and deletes targets in parallel while reporting progress and stats.
It’s intentionally simple:
- one job
- fast (but that’s entirely based on the std lol)
- multithreaded (again thanks andrew)
You can run it on the current directory, point it at a workspace, dry-run it, or even repurpose it to clean other directories like node_modules.
Binaries are available in the releases, or it can be built from source with Zig master.
Feedback welcome, It’s also not tested on anything except my machine, I don’t think I’ve blundered badly, it won’t break your system, but still use it to your own detriment ahah.
Here is the output :
$ zc -d
Would delete ./workspace/zigcleaner_/.zig-cache
Would delete ./workspace/cean/cleanup/side-project/zig/test/standalone/windows_entry_points/.zig-cache
....
Would delete ./workspace/cean/cleanup/side-project/zig/test/standalone/ios/.zig-cache
Would delete ./workspace/cean/cleanup/side-project/zig/test/link/wasm/stack_pointer/.zig-cache
Statistics:
Duration: 0.14s
Directories: 178307 scanned
Threads: 32 workers
Potential Reclaim: 6.58 GB
Throughput: 45.80 GB/s
Peak RSS: 17.93 MB