views:

69

answers:

1

I'm using PowerShell 2.0 and I want to pipe out all the subdirectories of a certain path.

The command

get-childitem c:\mypath -Recurse | ...

outputs all files and directories, but I can't figure out how to filter out the files.

I've tried using $_.Attributes to get the attributes but then I don't know how to construct a literal instance of System.IO.FileAttributes to compare it to.

What I want would be

dir /b /ad /s | ... 

in old-school DOS.

Thanks in advance.

+5  A: 
dir -r | ? { $_.psiscontainer } | select fullname
xcud
Wish that was aliased to "IsFolder".
xcud
Perfect, thanks. I knew there had to be an easy way!
Peter Hull
xcud: Not every hierarchy represented by a PSDrive is folder-based.
Joey
The semantic gap between "container" and "folder" is not one you can drive a truck through.
xcud