Skip to content

Instantly share code, notes, and snippets.

@Kyu
Created January 2, 2018 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kyu/bc50ddcdabe2fc5136c66240740f3bd2 to your computer and use it in GitHub Desktop.
Save Kyu/bc50ddcdabe2fc5136c66240740f3bd2 to your computer and use it in GitHub Desktop.
#from: https://stackoverflow.com/a/26494912
$colItems = Get-ChildItem $startFolder | Where-Object {$_.PSIsContainer -eq $true} | Sort-Object
foreach ($i in $colItems)
{
$subFolderItems = Get-ChildItem $i.FullName -recurse -force | Where-Object {$_.PSIsContainer -eq $false} | Measure-Object -property Length -sum | Select-Object Sum
$i.FullName + " -- " + "{0:N2}" -f ($subFolderItems.sum / 1MB) + " MB"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment