private string SearchForFile(string rootDirectory, string fileName)
{
// Try and find the file in this directory
string filePath = Path.Combine(rootDirectory, fileName);
if (File.Exists(filePath))
return filePath;
// If it's not there look in the subdirectories
foreach (string subDirectory in Directory.GetDirectories(rootDirectory))
{
string found = SearchForFile(subDirectory, fileName);
if (found != null)
return found;
}
// Otherwise it doesn't exist
return null;
}
}