I am attempting(without much luck) to search for a specific file but only if it exist in a particular directory.
For example: Say I would like to search for test.txt
but only if it resides within the directory structure of TestFolder(does not have to be in TestFolder but does have to be in one of the subfolders of TestFolder). The location of TestFolder is not known.
I have tried this, but it errors out when it hits a dir it does not have access too.
string[] list = Directory.GetDirectories("c://", "TestFolder", SearchOption.AllDirectories);
The though was to find the directory and then search within the directory for the file.
Any help would be greatly appreciated!