> function dusage{ param([String]$tgtDir = (pwd).Path) filter dusage_filter{ $sum = (dir -literalpath $_.FullName -recurse -force -erroraction silentlycontinue | measure-object Length -sum).Sum $result = New-Object Object | Add-Member NoteProperty Folder $_.FullName -PassThru | Add-Member NoteProperty Size $sum -PassThru return $result } dir $tgtDir -force -erroraction silentlycontinue | ? {$_.PSIsContainer} | dusage_filter } > dusage -tgtDir "c:\work" | sort -des size