PowerShell : Get Folder Size on Disk, One-Line Command

I mentioned in the last part that you should be able to get the sizes of sub-folders within a folder with Measure-Object and Group-Object.  So I had a bit of a tinker as an intellectual exercise and I worked up a one-liner that works.  Ish.  As I mentioned previously, this won’t automatically add the size of each sub-folder to the parent folder (so in the results you’d get C:\Source as 10 KB and C:\Source\Sub as 100 MB, for example).

Still, it was pretty interesting to hack it together.  The command and a brief explanation follows.

Continue reading “PowerShell : Get Folder Size on Disk, One-Line Command”