DEV Community

Hamza
Hamza

Posted on Originally published at tekmag.thsite.top

DiskTriage – A CLI Tool to Reclaim Space on Your Windows C: Drive

DiskTriage is an open-source Python command-line tool that scans more than 50 developer and gaming cache folders on a Windows machine and reclaims the space they hold. It was built after its author's boot SSD dropped to 2.7% free, which pushed disk read latency to 1.5 seconds and ended in a Windows blue screen of death. The tool offers three ways to free space: delete a rebuildable cache, move a cache to another drive and redirect it with an environment variable, or move it and leave an NTFS junction in place so you can roll back in one step. It ships in Portuguese (Brazil) by default with English (US) as an option, and it is released under the GPL-3.0 license.

DiskTriage, an open-source Python CLI for reclaiming space on a Windows C: drive

Key Takeaways

  • What it is: A Python CLI that scans 50+ developer and gaming cache folders and reclaims disk space without a graphical interface.
  • Why it exists: The author's boot SSD fell to 2.7% free, raising read latency to 1.5 seconds and triggering a BSOD (stop code 0x1E_C0000006, nt!HvpGetCellPaged).
  • Three strategies: Delete rebuildable caches; move a cache to a target drive and update the HKCU\Environment registry; or move it and create a reversible NTFS junction.
  • License and language: GPL-3.0, with a first-run choice between Portuguese (Brazil) and English (US).

The Problem: A Boot Drive Running on Empty

A Windows install grows slowly until the C: drive runs dry. That is a quiet failure mode. The pagefile, temp files, and Windows' own background writes all need headroom on the boot drive, and when free space gets thin, both reads and writes stall. The tool's author hit exactly this state. His boot SSD had 2.7% of its capacity left, which pushed disk read latency to 1.5 seconds and ended in a blue screen of death with stop code 0x1E_C0000006 (nt!HvpGetCellPaged). DiskTriage attacks the cause of that slowness, the drive itself, which is the opposite of the symptom-relief advice in our ten practical Windows 11 speed tweaks.

A near-full boot drive also starves the pagefile. When memory pressure forces the OS to swap, it has to write to the pagefile on that same drive, and with almost no room to grow, paging degrades fast. The result is a system that feels frozen, more than a disk that is merely full. This is the state the tool targets: it finds what is eating the space and moves or removes it before the drive tips from slow into broken.

Architecture: A Python CLI, Not a GUI

DiskTriage is a Python command-line program. The main logic lives in Python, and the interface is a terminal menu, not a window. That keeps it light enough to run over SSH and scriptable from other tools, which is the shape of the terminal-native developer tooling we covered with Claude Code: you run it where you already work.

Two design choices show up everywhere in the code. The first is scan persistence: it stores the results of the last scan, so the next run starts where it left off instead of re-walking the whole tree. The second is how it copies. It calls robocopy with multi-threading and pre-checks that the target drive has enough free space before it moves a single byte. It also does not follow junctions or symbolic links while it walks a folder, so a loop of links cannot hang the scan.

Before it cleans anything, it runs a health check. The --health flag reads free space on every drive, measures SSD read latency, notes where the pagefile lives, and lists the blue screens logged in the last 90 days. That output tells you whether you are actually short of space or just low on it.

Features: 50+ Cache Scans and an Interactive Menu

The scanner knows more than 50 cache locations across development tools and game platforms: pip, npm, cargo, docker, huggingface, pyenv, gradle, steam, and the rest. It also does a discovery pass that flags unusually large folders in the user profile and in AppData, so it catches things that are not a known cache but still eat space. Those known locations reach well past a single language, covering the build systems and package managers you see in a weekly developer-tools and GitHub roundup.

The menu is keyboard-driven. You move with the arrow keys and confirm with Enter. From there you can run the standard flags: --health to check only, --scan --drive D: to point the cleanup at a target drive, --min-gb 1.0 to list only items over a gigabyte, and --lang to pin the language. That combination means a full cleanup can be scripted in one line or done by hand in the menu.

The Three Move Strategies

For each item it finds, DiskTriage offers three ways to free the space, and the right one depends on whether you want it back on the same drive or on a second one.

The delete option removes caches that a tool can rebuild from scratch: pip wheels, npm packages, gradle artifacts, docker layers. Because the data is disposable, this is the fastest way to reclaim space, and the cost later is just another download.

Move plus environment variable takes a cache directory, moves its contents to a target drive, and edits the user's HKCU\Environment registry so the tools that use that cache keep finding it at the new location. The cache keeps working; it just lives on a drive with more room.

Move plus NTFS junction does the same move, then creates a junction at the original path so anything pointing at the old location follows the link. That makes the operation reversible: remove the junction and the move is undone in one step. The junction is created with mklink /J, as documented in Microsoft's mklink reference.

Safety: Hard Guards Around What It Deletes

The guards are explicit. Four paths are protected and off limits: WinSxS, System32, Windows\Installer, and Program Files. The tool will not delete from them even if they show up large.

Deletion is not a single click. When you choose to delete an item, it asks you to type the file or folder name to confirm, so a wrong selection does not wipe a cache you meant to keep. It checks that the target drive has room before it copies, and because it never follows junctions while scanning, a circular link cannot stall the run. The junction strategy adds a built-in undo on top of that: a move is reversible by removing the link.

Language and License

The interface defaults to Portuguese (Brazil) and offers English (US). On first run it asks which one you want, and the --lang flag pins it afterwards. The author is Brazilian, and the default reflects that.

DiskTriage is released under the GPL-3.0 license. That makes it free to use, modify, and share, with the copyleft terms that apply when you redistribute it.

Conclusion

DiskTriage is a narrow tool that does one job: find what is filling your C: drive and move or delete it safely. It is the kind of utility you keep in a folder and reach for when a boot SSD gets close to full, before the latency shows up in the task manager or, as the author found, in a blue screen. The three strategies are the reason it is more than a delete button: pick the least destructive option that fits your setup, delete when the cache is disposable, redirect with an environment variable when the data should keep working, or junction when you want a one-step rollback.

FAQ

Does DiskTriage delete my programs or system files?

No. It targets cache and build-artifact folders. Four system paths are protected and cannot be deleted: WinSxS, System32, Windows\Installer, and Program Files.

What is the difference between the three move strategies?

Delete removes rebuildable caches outright. Move plus environment variable moves the cache to another drive and edits the user registry so tools keep finding it. Move plus NTFS junction does the same move but leaves a link at the old path, which makes the operation reversible in one step.

Do I need an administrator account to run it?

Scanning the user profile and AppData does not need admin rights. Moving a cache under Program Files or writing certain registry keys will prompt for elevation on Windows.

Can I roll back a move?

Only with the junction strategy. Move plus NTFS junction leaves a link at the original path, so undoing it is one step. The environment-variable strategy and plain delete are not reversible the same way; a deleted cache is rebuilt by re-downloading it.

Is it free to use and modify?

Yes. It is licensed under GPL-3.0, which allows use, modification, and redistribution under the copyleft terms.


References

  1. DiskTriage, GitHub repository (ricardoborges/DiskTriage) - https://github.com/ricardoborges/DiskTriage
  2. Show HN: DiskTriage, Hacker News - https://news.ycombinator.com/item?id=49678341
  3. Microsoft, mklink reference (NTFS junctions) - https://learn.microsoft.com/en-us/windows-server/administration/windows/mklink

This article was published on TekMag. Facts are as documented in the DiskTriage repository and the linked sources; stop code and latency figures are from the author's write-up.

Top comments (0)