Hi, I want to delete a set of files but in an efficient way.
I have an array of string called filesToUse that contains the list of files names to keep in disk. Then, I search in my folder all files but I need check every files do not match with any element in my array. By example:
foreach(string sFile in System.IO.Directory.GetFiles("C:\\*.bmp"))
    bool flag = false;
    foreach (string s in filesToUse)
        if (s.Equals(sFile))
          flag = true;
    if(flag) System.IO.File.Delete(sFile); //anyone of these are in filesToUse
I think that both foreach is unnecessary, any better solution without use 2 for's?
Thanks in advance