参考:
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;
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 |
声明: Announce: |