469,631 Members | 1,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

how to remove "Read Only" from file on remote server

How to remove "Read Only" status on a file on a remote server?

My goal is to delete the file, but

System.File.Delete(\\machine1\c$\folder1\file1.txt )

is giving me an "Access is denied" error.

My log-on account is member of MACHINE1's local Administrators group.
Nov 17 '05 #1
1 10507
On Thu, 28 Apr 2005 18:28:05 -0700, John Grandy wrote:
How to remove "Read Only" status on a file on a remote server?

My goal is to delete the file, but

System.File.Delete(\\machine1\c$\folder1\file1.txt )

is giving me an "Access is denied" error.

My log-on account is member of MACHINE1's local Administrators group.


To remove an attribute use System.IO.File.SetAttributes. Ex:

System.IO.FileAttributes atts =
System.IO.File.GetAttributes(@"\\machine1\c$\folde r1\file1.txt");
atts &= ~System.IO.FileAttributes.ReadOnly;
System.IO.File.SetAttributes(@"\\machine1\c$\folde r1\file1.txt", atts);
--
Tom Porterfield
Nov 17 '05 #2

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 James | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.