How can C # change a file attribute while preserving the value of its other attributes?
File.SetAttributes(file_path, FileAttributes.ReadOnly); So the file will have the ReadOnly attribute set and all others will disappear.
How can C # change a file attribute while preserving the value of its other attributes?
File.SetAttributes(file_path, FileAttributes.ReadOnly); So the file will have the ReadOnly attribute set and all others will disappear.
Like this:
File.SetAttributes(file_path, File.GetAttributes(file_path) | FileAttributes.ReadOnly); Or so:
new FileInfo(file_path).Attributes |= FileAttributes.Hidden; Source: https://ru.stackoverflow.com/questions/581865/
All Articles