Sort files by extension with total size
For several reasons, it could be awesome to sort a folder and sub by extension, with the associated size for each.
$results=Get-ChildItem -Path "y:\" -Recurse | #Get only files Where-Object { !$_.PSIsContainer } | #Group by extension Group-Object Extension | #Get data Select-Object @{n="Extension";e={$_.Name -replace '^\.'}}, @{n="Size (MB)";e={[math]::Round((($_.Group | Measure-Object Length -Sum).Sum / 1MB), 2)}}, Count $results |Sort-Object "Size (MB)"|Export-csv "$WorkingDir\Results\$ResultFile" -NoTypeInformation