Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

get-childitem . -Name | where {$_.PsIsContainer} not working in 1.

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-09-2007   #1 (permalink)
brato
Guest


 

get-childitem . -Name | where {$_.PsIsContainer} not working in 1.

Hi,

The following command works on RC1 and RC2, but it dosen't work on the
powershell 1.0 release.

get-childitem . -Name | where {$_.PsIsContainer}

This above command returns all directories only. This dosen't return any
results in powershell 1.0. Does anyone know if this is a bug and how can I
overcome this.

Thanks,
Bharat

My System SpecsSystem Spec
Old 03-09-2007   #2 (permalink)
George Davis
Guest


 

RE: get-childitem . -Name | where {$_.PsIsContainer} not working in 1.

The following gets all sub-directories of the current folder:

get-childitem | where {$_.PsIsContainer}

--George

"brato" wrote:

> Hi,
>
> The following command works on RC1 and RC2, but it dosen't work on the
> powershell 1.0 release.
>
> get-childitem . -Name | where {$_.PsIsContainer}
>
> This above command returns all directories only. This dosen't return any
> results in powershell 1.0. Does anyone know if this is a bug and how can I
> overcome this.
>
> Thanks,
> Bharat

My System SpecsSystem Spec
Old 03-09-2007   #3 (permalink)
brato
Guest


 

RE: get-childitem . -Name | where {$_.PsIsContainer} not working i

No I want only the directory names. So the one below dosen't work for me.
-Name returns only the directory names.

Thanks,
Bharat

"George Davis" wrote:

> The following gets all sub-directories of the current folder:
>
> get-childitem | where {$_.PsIsContainer}
>
> --George
>
> "brato" wrote:
>
> > Hi,
> >
> > The following command works on RC1 and RC2, but it dosen't work on the
> > powershell 1.0 release.
> >
> > get-childitem . -Name | where {$_.PsIsContainer}
> >
> > This above command returns all directories only. This dosen't return any
> > results in powershell 1.0. Does anyone know if this is a bug and how can I
> > overcome this.
> >
> > Thanks,
> > Bharat

My System SpecsSystem Spec
Old 03-09-2007   #4 (permalink)
RichS
Guest


 

RE: get-childitem . -Name | where {$_.PsIsContainer} not working i

Get-ChildItem . | where{$_.Psiscontainer} | select name

will do what you want. According to the help file on get-childitem if you
use -name it will only pass the name into the pipeline which is why you can't
then use the where cmdlet
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"brato" wrote:

> No I want only the directory names. So the one below dosen't work for me.
> -Name returns only the directory names.
>
> Thanks,
> Bharat
>
> "George Davis" wrote:
>
> > The following gets all sub-directories of the current folder:
> >
> > get-childitem | where {$_.PsIsContainer}
> >
> > --George
> >
> > "brato" wrote:
> >
> > > Hi,
> > >
> > > The following command works on RC1 and RC2, but it dosen't work on the
> > > powershell 1.0 release.
> > >
> > > get-childitem . -Name | where {$_.PsIsContainer}
> > >
> > > This above command returns all directories only. This dosen't return any
> > > results in powershell 1.0. Does anyone know if this is a bug and how can I
> > > overcome this.
> > >
> > > Thanks,
> > > Bharat

My System SpecsSystem Spec
Old 03-09-2007   #5 (permalink)
Keith Hill [MVP]
Guest


 

Re: get-childitem . -Name | where {$_.PsIsContainer} not working i

"RichS" <RichS@discussions.microsoft.com> wrote in message
news:0680228B-1115-4DAF-9F91-512272A50AB0@microsoft.com...
> Get-ChildItem . | where{$_.Psiscontainer} | select name
>
> will do what you want. According to the help file on get-childitem if you
> use -name it will only pass the name into the pipeline which is why you
> can't
> then use the where cmdlet


Yep that name is passed as a string type which doens't have a PSIsContainer
property. Rich's approach is the one I would take.

--
Keith


My System SpecsSystem Spec
Old 03-11-2007   #6 (permalink)
Flowering Weeds
Guest


 

Re: get-childitem . -Name | where {$_.PsIsContainer} not working i


Another way

Perhaps Microsoft's Log Parser 2.2

PS> LogParser -h -i:fs

Input format: FS (FileSystem properties)
Returns properties of files and folders



My System SpecsSystem Spec
Closed Thread
Update your Vista Drivers Update Your Drivers Now!!

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
get-childitem bug? RJ PowerShell 2 02-29-2008 01:29 PM
using Get-ChildItem foamy PowerShell 9 02-15-2008 04:32 AM
get-childitem Brandon Shell [MVP] PowerShell 4 12-03-2007 12:58 PM
Bug in Get-ChildItem -exclude loworbit@gmail.com PowerShell 4 12-19-2006 05:58 PM
Understanding Get-ChildItem Staffan Gustafsson PowerShell 1 06-12-2006 07:05 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51