PowerTip: Quickly Show Folders and Subfolders in PowerShell 3.0
Summary: Use Windows PowerShell 3.0 to quickly show folders and subfolders.
How can I use Windows PowerShell 3.0 to quickly show folders and subfolders?
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-ChildItem, select is an alias for Select-Object, and sort is an alias for Sort-Object.