开发者

how to delete a file?

开发者 https://www.devze.com 2023-01-14 13:44 出处:网络
Ho开发者_StackOverflow中文版w do I delete a file, given the full path to the file?You want File.Delete.

Ho开发者_StackOverflow中文版w do I delete a file, given the full path to the file?


You want File.Delete.

File.Delete(@"C:\Documents and Settings\Vijay.EKO-03\Desktop\blockseek3-9-2010\Block3.xml");


File.Delete(string path) method will work I think.


var file = new System.IO.File(path);
file.Delete();


Basically, you can just call the static delete method on the file class.

System.IO.File.Delete(@"C:\Documents and Settings\Vijay.EKO-03\Desktop\blockseek3-9-2010\Block3.xml");


Have you tried this??? I think it will solve your problems:

FileInfo i = new FileInfo("PATH TO YOUR FILE");

i.Delete();

Remeber to add:

using System.IO;
0

精彩评论

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

关注公众号