I wrote this command to show the size of all sub-folders in a folder:
dir | ? { $_.PsIsContainer } | % { $t=0;dir -rec $_.Name | % {$t +=
$_.Length }; @{$_.Name=$t}}
This outputs:
Name Value
---- -----
Avaya 1887047
C# 294
PowerShell 8643
Regular Expressions 161
Sql 3914
Windows 1964032
Now, I'd like to sort them by size (or the "Value" property of the
Hashtable). I append "sort value" to the end of my command:
dir | ? { $_.PsIsContainer } | % { $t=0;dir -rec $_.Name | % {$t +=
$_.Length }; @{$_.Name=$t}} | sort value
But I get:
Name Value
---- -----
Regular Expressions 161
Sql 3914
Windows 1964032
Avaya 1887047
C# 294
PowerShell 8643
How do I get this to sort?!


