Ask Your Question
1

What are the folders located at a specified depth or lower in Powershell?

asked 2021-07-14 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-06-02 11:00:00 +0000

ladyg gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-07-14 11:00:00 +0000

Seen: 7 times

Last updated: Jun 02 '22