469,889 Members | 1,314 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,889 developers. It's quick & easy.

Deleting "Read Only" files

Hello,
Whenever I try to delete a Read Only file using FileInfoObject.Delete I get
"Access to the path "File name and path" is Denied" error. This does not
happen with other files. Any ideas? Thank you.
May 1 '06 #1
2 1354
Change it to not be readonly first.

You can get whether or not it is readonly by checking the FileInfo object's
attributes

http://msdn2.microsoft.com/en-us/lib...ttributes.aspx

You can then set it to not be readonly using

http://msdn2.microsoft.com/en-us/lib...ttributes.aspx
A quick google also brought up
http://www.thescripts.com/forum/thread270312.html which also suggests using
WMI which supposedly does not have the same restriction.

Cheers,

Greg

"James" <ja***@nodomain.net> wrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
Hello,
Whenever I try to delete a Read Only file using FileInfoObject.Delete I
get "Access to the path "File name and path" is Denied" error. This does
not happen with other files. Any ideas? Thank you.

May 1 '06 #2
Using SetAttributes did the trick. Thanks!


"Greg Young" <Dr*************@hotmail.com> wrote in message
news:eg**************@TK2MSFTNGP02.phx.gbl...
Change it to not be readonly first.

You can get whether or not it is readonly by checking the FileInfo
object's attributes

http://msdn2.microsoft.com/en-us/lib...ttributes.aspx

You can then set it to not be readonly using

http://msdn2.microsoft.com/en-us/lib...ttributes.aspx
A quick google also brought up
http://www.thescripts.com/forum/thread270312.html which also suggests
using WMI which supposedly does not have the same restriction.

Cheers,

Greg

"James" <ja***@nodomain.net> wrote in message
news:e$**************@TK2MSFTNGP03.phx.gbl...
Hello,
Whenever I try to delete a Read Only file using FileInfoObject.Delete I
get "Access to the path "File name and path" is Denied" error. This does
not happen with other files. Any ideas? Thank you.


May 1 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by ZafT | last post: by
3 posts views Thread by Stinky Pete | last post: by
2 posts views Thread by Michael A. Covington | last post: by
1 post views Thread by John Layton | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.