Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Search files on specific depth level

$
0
0

I’m not sure I fully understand the question. However, there’s a neat trick with PowerShell and Get-ChildItem that allows you to search at a specific depth using wildcards:

Get-ChildItem -Path 'RootFolder\*\*\*'

This will return all items that are nested two levels deep beneath RootFolder, for example, “RootFolder\SubFolder1\SubFolder2\file.txt”, etc. This is much shorter than writing a recursive function yourself.


Viewing all articles
Browse latest Browse all 13067

Trending Articles