Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to delete all files in a directory c#

System.IO.DirectoryInfo di = new DirectoryInfo("YourPath");

foreach (FileInfo file in di.GetFiles())
{
    file.Delete(); 
}
foreach (DirectoryInfo dir in di.GetDirectories())
{
    dir.Delete(true); 
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #delete #files #directory
ADD COMMENT
Topic
Name
8+2 =