How do you programatically remove the "read-only" attribute from a file in a certain directory. I know in VB - I used a shell command in VB - but I suppose there is a more elegant way in C#.
Regards
This is a discussion on Read only attribute within the C# Programming forums, part of the General Programming Boards category; How do you programatically remove the "read-only" attribute from a file in a certain directory. I know in VB - ...
How do you programatically remove the "read-only" attribute from a file in a certain directory. I know in VB - I used a shell command in VB - but I suppose there is a more elegant way in C#.
Regards
Code:using System; using System.IO; using System.Text; class FileAttributesExample { public static void Main() { // Remove read only attribute string filepath = @"c:\temp\Readonly.txt"; File.SetAttributes(filepath, FileAttributes.Archive); } }