Thread: ls -h
View Single Post
Old 08-29-2007   #5 (permalink)
Storm Rider


 
 

Re: ls -h

Thanks Keith, didn't realize that was already part of PSCX.

Sean

"Keith Hill [MVP]" wrote:
Quote:

> "Storm Rider" <StormRider@xxxxxx> wrote in message
> news:79F15DDD-F614-418C-8728-5F814AD9D046@xxxxxx
Quote:

> > -h use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and
> > Petabyte in order to reduce the number of digits to four or fewer using
> base
Quote:

> > 2 for sizes.
>
> OK it isn't pretty but it works:
>
> gci | format-table `
> @{l='Mode';w=5;e={$_.Mode}},
> @{l='LastWriteTime';w=22;a="right";e={$_.LastWriteTime}},
> @{l='Length';w=12;a='right';e={$_.Length | format-byte}},
> Name
>
> Note that this does use the Format-Byte cmdlet from the PowerShell
> Community Extensions. However if you download and use that, you can set
> this on a global basis:
>
> 233# $PscxFileSizeInUnitsPreference = $true
> 234# gci
>
>
> Directory: Microsoft.PowerShell.Core\FileSystem::\Downloads
>
>
> Mode LastWriteTime Length Name
> ---- ------------- ------ ----
> -a--- 7/10/2007 11:56 AM 1.16 GB
> 6.0.6000.0.0.WindowsSDK_Vista_rtm.DVD.Rel.img
> -a--- 7/31/2007 10:35 PM 1.144 GB
> 6.0.6001.16621.148.WindowsSDK_LonghornServer_
>
> --
> Keith
> http://www.codeplex.com/powershellcx
>
My System SpecsSystem Spec