List hidden sub-directories and sizes

The -Force argument for Get-ChildItem will cause it to include hidden files and directories.

Get-ChildItem -Force | Where-Object { $_.PSIsContainer } | ForEach-Object { $_.Name + ": " + "{0:N2}" -f ((Get-ChildItem $_ -Recurse -Force | Measure-Object Length -Sum -ErrorAction SilentlyContinue).Sum / 1MB) + " MB" }

Leave a Comment