In a Windows Forms application I would like to know how to fetch all files that exist and contain the word teste
in the file extension. For example, opening a folder in Windows and typing *.teste*
into the search field will return all files that contain that word in its extension regardless of whether it is .teste1
, .teste2
...
string Diretorio = @"C:\teste\";
string Arquivo = Diretorio + Codigo.Trim() + "E" + "\" + Data;
if (File.Exists(Arquivo + ".teste"))
{
Retorno = true;
}
In the code snippet above, the word teste
was set to a file extension. However if I have the file with the extension .teste1
or .teste2
the file will no longer be found.