I want to search a directory and its subdirectories for a single file.
The directory tree is very large and i don't want to search all the directory tree , but just search to the first found file.
Currently I have tried the following:
IEnumerable<string> files = Directory.EnumerateFiles(
Directory.GetCurrentDirectory(),
"myFile.ext",
SearchOption.AllDirectories);
myFileInfo = new FileInfo(files.First());
the problem with the code above is that it search all the directory tree.
my main focus in finding the file is performance.