I have the following piece of code:
foreach (string file in Directory.GetFiles(sourcePath))
{
// whatever
}
That gets files from a specific directory. Would it be possible to match directories using a wildcard? For example:
c:\test\di*
would match all files in the directories:
c:\test\dictionary\
c:\test\directory\
c:\test\dig\
I saw that you can pass a file filter to the GetFiles method, but that applies to files only, not directory names.
You have an overload for this which allows you to specify a search pattern or if you need to specify search options there’s another overload: