Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove readonly attribute from directory

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

like image 998
Red Swan Avatar asked Feb 23 '10 05:02

Red Swan


People also ask

Why can I not remove read only from a folder?

If your folder keeps reverting to read-only it could be due to a recent Windows 10 upgrade. Many users have reported that when upgrading their system to Windows 10, they encountered this error. Read-only is a file/folder attribute that lets only a specific group of users read or edit the files or folder.


1 Answers

var di = new DirectoryInfo("SomeFolder"); di.Attributes &= ~FileAttributes.ReadOnly; 
like image 178
Darin Dimitrov Avatar answered Sep 20 '22 03:09

Darin Dimitrov