Let say, a file has the following attributes: ReadOnly, Hidden, Archived, System
.
How can I remove only one Attribute? (for example ReadOnly)
If I use the following, it removes all the attributes:
IO.File.SetAttributes("File.txt",IO.FileAttributes.Normal)
Answering on your question in title regarding ReadOnly
attribute:
FileInfo fileInfo = new FileInfo(pathToAFile);
fileInfo.IsReadOnly = false;
To get control over any attribute yourself you can use File.SetAttributes()
method. The link also provides an example.