How do I change the Read-only file attribute for each file in a folder using c#?
c#
Solution
foreach (string fileName in System.IO.Directory.GetFiles(path))
{
System.IO.FileInfo fileInfo = new System.IO.FileInfo(fileName);
fileInfo.Attributes |= System.IO.FileAttributes.ReadOnly;
// or
fileInfo.IsReadOnly = true;
}
Problem
How do I change the Read-only file attribute for each file in a folder using c#? Thanks