In PowerShell, dir is an alias for the Get-ChildItem cmdlet.
Use it with the -Recurse parameter to recursively represent child elements:
Get-ChildItem -Recurse
If you only need directories, not files, use the -Directory switch:
Get-ChildItem -Recurse -Directory
The -Directory switch -Directory introduced for the file system provider in version 3.0.
For PowerShell 2.0, filter the PSIsContainer property:
Get-ChildItem -Recurse |Where-Object {$_.PSIsContainer}
(PowerShell aliases support parameter resolution, so Get-ChildItem can replace Get-ChildItem with dir in all the examples above)
source share