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
Printable View
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);
}
}