The best approach for figuring out something, is to start googling and reading the documentation
GetDirectories(String, String)
Returns the names of subdirectories (including their paths) that match
the specified search pattern in the specified directory.
searchPattern
can be a combination of literal and wildcard
characters, but it doesn't support regular expressions. The following
wildcard specifiers are permitted in searchPattern
.
Wildcard specifier Matches
*
(asterisk) Zero or more characters in that position.
?
(question mark) Zero or one character in that position.
So here is a little method that can help you
public string GetFolder(string index, string path)
=> Directory.GetDirectories(path, $"{index}.*")
.FirstOrDefault();
Usage
var dir = GetFolder("0001", @"C:\MyHomeWorkFolder");
if(dir != null)
// we have found something