If your goal is take a list (in this case, of FileNames) and quickly determine which items (in this case, strings) can be excluded based on some criterion (in this case, a match in a set of strings), consider something like this:
using System;
using System.Collections.Generic;
using System.Linq;
IgnoreFolders = new List<string>
{
"SYNC ISSUES",
"TRASH",
"JUNK",
};
TestNames = new List<string>
{
"SYNC ISSUES1",
"SYNC ISSUES2",
"sometrash", "trash more", "my trash is",
"myJUNK", "junkYOUR", "JUNKJUNKJUNK",
"good name 1", "june bug good name",
"tras hot good name", "jun k tras h"
};
var FileNamesToIgnore = TestNames
.Where(name => IgnoreFolders
.Any(itm => name.ToUpper()
.Contains(itm)));
var GoodToGoFileNames = TestNames.Except(FileNamesToIgnore);
You could easily wrap this code in a Function; for re-use, I'd suggest having a boolean flag in that function that determined whether letter-case should be ignored (as in the example, here).