Get-ChildItem \* <- one level
Get-ChildItem \*\* <- two levels
Get-ChildItem \*\*\* <- three levels
etc, etc
You can substitute
dir for
Get-ChildItem, (dir is just an alias for it), but using Get-ChildItem differentiates it from a normal DOS command.
From
StackOverflow:
Get-ChildItem \* | % { if ($_.Attributes -eq "Directory") { Write-Host $_.FullName } } <- one level from root, directories only, full path output one per line
Get-ChildItem .\* | % { if ($_.Attributes -eq "Directory") { Write-Host $_.FullName } } <- one level from current, directories only, full path output one per line
Get-ChildItem \*\*\*\* | % { if ($_.Attributes -eq "Directory") { Out-File d:\out.txt -append -inputobject $_.FullName } }
The above will output normal folders to 4 levels deep to a file called D:\out.txt <- change as you will.