You can use the method GetFiles
class Directory
, that returns an array of strings with the name of each file found.
You just need to inform the folder where it will be perform the search in your case, C:\\
;
The filter for searching, in your case the file name;
And the search option, in your case, AllDirectories
to search in all subfolders.
Follows the code:
string arquivo = "arquivo.txt";
string[] files = Directory.GetFiles("C:\\", arquivo, SearchOption.AllDirectories);
foreach (string file in files)
{
Process.Start(file); //abre o arquivo
Process.Start(new FileInfo(file).DirectoryName);//abre a pasta do arquivo
}