Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

find and delete files c#

string rootFolderPath = @"C:SomeFolderAnotherFolderFolderCOntainingThingsToDelete";
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);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #delete #files
ADD COMMENT
Topic
Name
2+9 =