To check whether a file has any attribute or not.

Gopesh9
Posted by Gopesh9 under C# category on | Points: 40 | Views : 881
bool isReadOnly = ((File.GetAttributes(filePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly);
bool isHidden = ((File.GetAttributes(filePath) & FileAttributes.Hidden) == FileAttributes.Hidden);
bool isArchive = ((File.GetAttributes(filePath) & FileAttributes.Archive) == FileAttributes.Archive);
bool isSystem = ((File.GetAttributes(filePath) & FileAttributes.System) == FileAttributes.System);

Comments or Responses

Login to post response