C#C
C#3y ago
00tree00

Delete only specific files

Hi everyone

I would like the application to delete only the files that are in the array, I tried to do it this way but unfortunately it doesn't delete the files, maybe someone knows how to fix this?


string[] gamePaths = Directory.GetFiles(rootPath);


foreach (string gamePathss in gamePaths)
 {
   var name = new FileInfo(gamePathss).Name;
   name = name.ToLower();
   if (name == "d3dcompiler_43.dll" & name == "d3dx9_43.dll" & name == "glew32.dll" & name == "init.lua" & name == "libcrypto.dll" & name == "libcrypto-1_1.dll" & name == "libcurl.dll" & name == "libEGL.dll" & name == "libgcc_s_dw2-1.dll" & name == "libGLESv2.dll" & name == "libluajit.a" & name == "libssl-1_1.dll" & name == "libstdc++-6.dll" & name == "libwinpthread-1.dll" & name == "openal32.dll" & name == "otclientrc.dll" & name == "zlib.dll")
   {
     File.Delete(gamePathss);
   }
 }
Was this page helpful?