# add '-recurse' to include sub folders
Get-ChildItem -Path $directory -Directory
This command will return all the folders in a directory, and does not return the files. Include ‘-recurse’ parameter to also return sub folders
PS C:\> $directory = "C:\temp" >> Get-ChildItem -Path $directory -Directory Directory: C:\temp Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 6/19/2019 12:53 PM Logs