0

Im sure there are other ways to do this, but im trying to learn and trying to see how I can convert this length output to GB format

dir $env:USERPROFILE -Recurse -File | sort-object -property length | select -last 10

Thanks alot!

Romeo Ninov
  • 7,848
Matt
  • 3
  • 1
  • 4

1 Answers1

1

Unfortunately there is no easy -h like in Linux. You could do it like this:

select *,@{n='Length (GB)';e={$_.Length / 1GB}} -exclude length -last 10

Basically you select every property (*) add a calculated property to the output @{n='Length (GB)';e={$_.Length / 1GB}} and exclude the normal length (optional)

SimonS
  • 9,869