Formatting file listings–the other way
Following on from the previous post I was asked if the bit where we set the case on the file names and extension could be done in a select statement.
Simple answer is yes
Get-ChildItem |
where {-not $_.PSIsContainer} |
sort Fullname |
select @{N="FullName"; E={$($_.Fullname.ToUpper())}},
@{N="Extension"; E={$($_.Extension.ToLower())}},
Length, LastWriteTime |
Format-Table -Autosize
Calculated fields can be used in Format-Table and Select-Object cmdlets
I didn’t mention previously – N is short for Name and E is short for Expression above