开发者

delete files from folder

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜