📅  最后修改于: 2022-03-11 14:49:06.392000             🧑  作者: Mango
string rootFolderPath = @"C:\\SomeFolder\\AnotherFolder\\FolderCOntainingThingsToDelete";
string filesToDelete = @"*DeleteMe*.doc"; // Only delete DOC files containing "DeleteMe" in their filenames
string[] fileList = System.IO.Directory.GetFiles(rootFolderPath, filesToDelete);
foreach(string file in fileList)
{
System.Diagnostics.Debug.WriteLine(file + "will be deleted");
// System.IO.File.Delete(file);
}