How do you remove files fr开发者_如何学Goom a folder using ASP.Net with C# ?
foreach (var file in Directory.GetFiles(path))
{
File.Delete(file);
}
Same as the above answers, but lambda-fied, if that's your thing...
Array.ForEach(Directory.GetFiles(path), File.Delete);
You could try
string[] files = Directory.GetFiles("Path");
foreach (string file in files)
File.Delete(file);
精彩评论