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.
Asked: 2021-07-14 11:00:00 +0000
Seen: 7 times
Last updated: Jun 02 '22