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.