How about this, the code below will give you a list of files (full name as a string); the reason why returning as a list is because your subdirectories may have the same file name as "test.txt".
var list = Directory.EnumerateFiles(@"c:\temp\", "test.txt",
SearchOption.AllDirectories);
if you are sure that the test.txt file will be in only one of the directories, you can use:
string fullname = Directory.EnumerateFiles(@"c:\temp\", "test.txt",
SearchOption.AllDirectories).FirstOrDefault();
if (fullname != null) { ..... }
source
share