PowerTip: Quickly Show Folders and Subfolders in PowerShell 3.0

PowerTip: Quickly Show Folders and Subfolders in PowerShell 3.0

  • Comments 1
  • Likes

Summary: Use Windows PowerShell 3.0 to quickly show folders and subfolders.

Hey, Scripting Guy! Question How can I use Windows PowerShell 3.0 to quickly show folders and subfolders?

Hey, Scripting Guy! Answer Use the Get-ChildItem cmdlet with the –Directory and the –Recurse switch. Select only parent and name. This command is shown here. Sort on the parent property. 

gci -Recurse -Directory | select parent, name | sort parent

Note  gci is an alias for Get-ChildItemselect is an alias for Select-Object, and sort is an alias for Sort-Object.

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • try just typing "tree"