Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To list all the folders located at a specified depth or lower in Powershell, you can use the following command:

Get-ChildItem -Path "C:\YourFolderPath" -Directory -Recurse -Depth 3

In this command, you need to replace "C:\YourFolderPath" with the actual path you want to search. The parameter "-Directory" specifies that you only want to list folders, not files. The parameter "-Recurse" specifies that you want to search recursively through all subfolders. The parameter "-Depth 3" specifies that you only want to list folders at the specified depth or lower. You can adjust the number 3 to a different value based on your desired depth.