How does Read-Only affect a Directory?
- by ispiro
I've found that I can write (say, copy a file into) a Read-Only directory. That is, a Directory with ...Attributes = FileAttributes.ReadOnly.I can even change its name. The only thing I've found that can't be done is to delete it. Is that really the only thing that ReadOnly prevents?
EDIT:
Here's the code: (The Directory is empty.)
(new DirectoryInfo(path)).Attributes = FileAttributes.ReadOnly;
Directory.Delete(path);
It throws an Access to the path 'c:\... is denied. exception.
But after changing ReadOnly to Normal it works fine.
So what does a ReadOnly prevent, and what doesn't it prevent?