Wildcards in Paths


#1

Can you use a “*” in a variable that is a path to somewhere on the machine? If so,could I see an example? Thank you.


#2

You can use, however Windows will treat it as a path string, so may not work if ‘’ is used in directory name.
If you want to fetch file name starting with ‘abc’, and you are using your variable like 'LocalDrive\abc
’, again it will not bring the desired results.
So, better to use GetAllFiles from a Directory method (as used in VB.NET) and filter using string manipulations.

Wildcards * and ? are used generally in selectors so that, it can be more generalized.