Skip to content

PFalkowski/DiskSpaceAnalyzer

Repository files navigation

DiskSpaceAnalyzer

CI CodeQL Quality Gate Status .NET Platform License: MIT Buy Me a Coffee

A simple, interactive console tool to find what is eating your disk space, then drill into the biggest folders and files — WinDirStat-style, but keyboard-only. Read-only: it never deletes or moves anything; it can open Explorer so you do the cleanup yourself.

Build & run

dotnet build
dotnet run --project DiskSpaceAnalyzer -- "C:\"
  • With no argument it scans the drive it is running from.
  • Pass a path to scan just that folder: dotnet run --project DiskSpaceAnalyzer -- "C:\Users\me".

It walks the whole tree (a nearly-full 1 TB drive takes a few minutes — this reads the filesystem rather than the raw NTFS MFT), showing a live progress line, then drops you into the explorer.

Find the biggest files

To just list the biggest individual files across a drive/folder and exit — no drilling — use --top (alias -t), optionally with a count (default 10):

dotnet run --project DiskSpaceAnalyzer -- "C:\" --top 20
Biggest 20 file(s) under C:\:
--------------------------------------------------------------------------------
 1.    19.18 GiB  C:\hiberfil.sys
 2.     4.20 GiB  C:\Users\me\Downloads\ubuntu.iso
 ...

The same list is available inside the interactive explorer at any time by pressing T (or T<n>, e.g. T25).

Exploring

Each screen shows the drive's free space, the current folder's total, and its biggest child folders and files ranked by size with a proportional bar:

  1. [##############]    16.78 MiB  [DIR ] Extensions.Standard.Test
  6. [#.............]     4.55 KiB  [FILE] .gitignore

Commands:

Input Action
<#> enter that folder (or show a file's details)
U go up to the parent folder
O reveal the current folder in Explorer
O<#> reveal that item (file/folder) in Explorer
T list the biggest files on the drive (T<n> for a count)
Q quit

A ! after an entry means some items in it could not be read (e.g. access-denied system folders); those are skipped and never block the scan.

How it works

  • Scanning/DirectoryScanner walks the tree, parallelising across the root's big subtrees. Junctions/symlinks (reparse points) are counted as zero and never recursed into, so there are no loops or double-counted mounted volumes; all I/O errors are swallowed and flagged.
  • Only directories are kept in memory (a full drive has millions of files); a folder's immediate files are enumerated on demand when you open it.
  • The biggest-files list is found in the same pass by a bounded min-heap (TopFilesCollector) that keeps only the largest N, with a lock-free threshold so small files never take the lock.
  • Human-readable sizes and durations come from the Extensions.Standard package (AsMemory(), AsTime()); the spinner/prompt helpers from ConsoleUserInteractionHelper.

Contributing

Issues and pull requests are welcome. dotnet test must stay green; CI runs build + tests on every push and PR. Static analysis runs via CodeQL (out of the box) and SonarCloud (see SONAR_SETUP.md for the one-time token setup).

License

MIT © Piotr Falkowski

Support

If this saved you some disk space (or time), you can buy me a coffee

About

Interactive, read-only console tool to find what's eating your disk space and drill into the biggest folders and files (Windows, .NET 10).

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages