Use the code below to remove ReadOnly file attribute.
using System.IO;
private void RemoveReadOnlyAttribute(string
filePath)
{
FileAttributes attributes = File.GetAttributes(filePath);
if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
File.SetAttributes(filePath,
attributes & ~FileAttributes.ReadOnly);
}