Answers for "find and delete files c#"

C#
12

c# how to delete a file

File.Delete(@"C:\Temp\Data\Authors.txt");
Posted by: Guest on March-10-2020
1

find and delete files c#

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);
}
Posted by: Guest on March-24-2021

Code answers related to "find and delete files c#"

C# Answers by Framework

Browse Popular Code Answers by Language