如何删除只读文件?

参考:

http://msdn.microsoft.com/zh-cn/library/aa497275.aspx

使用 System.IO.FileInfo 类来访问文件属性


System.IO.FileInfo fi = new System.IO.FileInfo("filename");

// remove readonly attribute
if ((fi.Attributes & System.IO.FileAttributes.ReadOnly) != 0)
    fi.Attributes 
-= System.IO.FileAttributes.ReadOnly;

System.IO.File.Delete(
"filename");


 
 
 
 

--------------------------------------------------

李森 – listen
E-mail:  lisencool@gmail.com

声明:
这里集中了在WinCEWindows Mobile开发中的一些基本常识。我很乐意和大家分享,也希望大家提出意见,并给我投稿,我会第一时间替您发表并署上您的大名!

Announce:
Here collects general knowledge on WinCE and Windows mobile. I 'm very glad to share them with all friends, and also hope you can share your problems and opinions and contribute articles to me to share with others. I'll publish your articles and sign your name at the first time.

  



posted on 2009-09-22 18:09  listenlisten  阅读(1482)  评论(3编辑  收藏  举报

导航