Frank Detzer

pwshdu

pwshdu

tl;dr - download @ github.com


pwshdu is my heavily inspired PowerShell module of “ncdu” (NCurses Disk Usage made by Yoran Heling). I was able to get in touch with him and he is fine with my project. My intend with this module is provide an easy and open-source console-based disk usage analyzer for PowerShell mainly used on windows. I have released “pwshdu” originally as “pwshdu” but have since renamed it.


I created this clone because I felt the need to have a console-based disk space analyzer on windows. The lack of such apps comes simply from the fact that until the 2019 server release came with a GUI based explorer even if it you needed to launch notepad and use the open file menu to do so. Since I was using PowerShell to do everything except this, I always felt this was break in the workflow.

pwshdu does not try to emulate every feature of ncdu and does some things on purpose differently. So here is a short list of design decisions I made that I intend to keep and some that will be added/fixed in the future:

Things done differently on purpose:

  • The display of the meta data of the analyzed folder before the actual output.
  • As you may noticed from the screenshot above the folders have an added forward-slash on them. I always thought this was particularly useful when I used “ls -laph” on my UNIX machines. The engine of pwshdu allows for this to be disabled already but I think nobody seriously would want to remove them.
  • The lack of file/folder deletion. I like the idea of this kind of decelerating and having to do the deletion completely yourself.

Things that will be added/fixed in the future:

  • The ability to only have the app analyze the disk only once and then being able to navigate through the cache. I already have something in mind but that needs extensive testing because I already can see it blowing up the pscustomobject(s).
  • Colors. I think that will be added sooner than later :)

I also want to talk about is the fact that this is non-interactive. Not only am I limited by the ability of the PowerShell to do so. I am not aware of any way to make pwsh interactive but with a GUI, which would render all this effort useless since there are way more advanced GUI based apps out there already. Not to forget that this would limit pwshdu to newer pwsh versions. If I find out a clever way to do archive this without making too much of a sacrifice I am happy to add this 😊

Output with a warning that not all files/folder were readable. This comes from the lack of permission in the ACL.

I developed pwshdu on pwsh 7.1 but testing on windows-PowerShell 5.1 and windows-PowerShell 3.0 did not show any signs of bugs or missing features. That is, except the alias-parameter cannot be bound on windows-PowerShell 3.0, but I already got that fixed in the next build.

Another short note, I found the following screenshot that I posted on my friends Discord almost a month ago. It shows an early development build with a demonstrated bugfix.

You can download/contribute to the module at GitHub. I am always open for ideas/suggestions. I also want to thank Anthony “the PowerShell Wolf” a lot for his easy and simply solution of determining the unit size. It did work so well, the only change I needed to make was a single variable.

Next post

pwshCopyScheduledTask

pwshdu