Remove readonly attribute from directory

Red Swan picture Red Swan · Feb 23, 2010 · Viewed 58.3k times · Source

How can I programatically remove the readonly attribute from a directory in C#?

Answer

Darin Dimitrov picture Darin Dimitrov · Feb 23, 2010
var di = new DirectoryInfo("SomeFolder");
di.Attributes &= ~FileAttributes.ReadOnly;