psisContainer: Filter Directories using Powershell

To filter the folders (i.e., directories) available in the current context, the following property can be used with a predicate:$_.psiscontainer

In essence, it returns a boolean indicating whether the current object is a directory or not. Hence, the following script prints the absolute path of the each sub-directories from the current context.

ls –r | ?{$_.psiscontainer} | select fullname
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s