Obviously, we will have to use get-childitem
However, -recurse option cannot help, since it has no stopping limit - it will recurse to the bottom of the directory
Here is a solution that I found that's short and simple, just the way I like it:
$search1 = "C:\temp\*"
$search2 = "C:\temp\*\*"
$search3 = "C:\temp\*\*\*"
$folders = Get-ChildItem -path $search1, $search2, $search3 | where-object {$_.PSIscontainer -and $_.name.StartsWith("Blue")}
...
No comments:
Post a Comment