csharp delete folder with all contents
Code Example - csharp delete folder with all contents
System.IO.Directory.Delete("C:\TempTest", True)
csharp how to delete a file
File.Delete(@"C:\Temp\Data\Authors.txt");
how to delete all files in a directory csharp
System.IO.DirectoryInfo di = new DirectoryInfo("YourPath");
foreach (FileInfo file in di.GetFiles())
{
file.Delete();
}
foreach (DirectoryInfo dir in di.GetDirectories())
{
dir.Delete(true);
}
delete all dir content csharp
new System.IO.DirectoryInfo(@"C:\Temp").Delete(true);
//Or
System.IO.Directory.Delete(@"C:\Temp", true);
How to delete folder with files on csharp
Directory.Delete(@"folderPath", true);