I need to check a directory to see if there are any files whose file name contains a specific keyword and if there are, to delete them. Is this possible?
For exampl
More or less, this:
string DeleteThis = "apple"; string[] Files = Directory.GetFiles(@"C:\Folder"); foreach (string file in Files) { if (file.ToUpper().Contains(DeleteThis.ToUpper())) { File.Delete(file); } }