Is there a way to determine how wildcard matching is done in Get-ChildItem?
Various articles (1, 2) suggest that it is done through the WildcardPattern class, but I don’t think this is the case. For example, suppose you have a file in C:\test\test2\testfile.txt
. Then Get-ChildItem –Path “C:\*\testfile.txt”
will not find the file while WildcardPattern::IsMatch
will. Wildcard "*"
matching in Get-ChildItem seems to be on directory level: so "\*\"
will never match more than one level, like "\A\B\"
.
So if WildcardPattern class isn't used, then what is?