How to make the code not delete a specific file I want among the .exe
I get. Example: I want it not to delete "test.exe", but still keep erasing everything else.
Follow the code:
string[] arquivos = Directory.GetFiles(@"C:\temp\ae", "*.exe", SearchOption.TopDirectoryOnly);
foreach (string arquivo in arquivos)
{
//nome = Path.GetFileName(arquivo);
File.Delete(arquivo);
}