Directory.GetFiles() searchpattern
.net, regex
Solution
I've had to deal with this myself when working with a File System Monitor. Adding onto what MichaelPerrenoud said You can run all of your matches through a quick filter, like:
bool ExtensionOf ( String f, String targetext ) {
return f.EndsWith( targetext );
}
If you don't need the flexibility of `targetext`, just replace it entirely with `".OUT"`
Good luck!
Problem
I have this basic code ``` Directory.GetFiles(filepath, "*.OUT") ``` In the filepath is a file named `Filename.OUT` The above code finds that file fine. Now, I rename the file by appending a UniqueID so that the file doesn't get picked up again. `Filename.OUT6F9619FF-8B86-D011-B42D-00C04FC964FF` However, the file is STILL getting picked up by `Directory.GetFiles()`! So, is the searchpattern (`*.OUT`) a regex pattern? If so, this makes sense. The info on MSDN doesn't seem to imply that it is. If not, is there a pattern I can use so that it doesn't get picked up?