Check if a file is read only in C#

bool isReadOnly = ((File.GetAttributes(filePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly);

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.