Categories

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>