I have been trying to toggle FileAttributes in C# code to no avail. Nothing
I have tried has worked and I have been unable to find anything anywhere on
toggling the bits properly.
Depending on the file I need to either turn off the "Archive" bit or the
"ReadOnly" bit; whether it is on or not I need to turn it off.
Everything I have tried generates an error.
Please Help.
Thanks in Advance
Frank
Something like this will turn off both Archive and ReadOnly attribute
bits. Modify to suit your needs:
FileAttributes attr = FileAttributes.Archive |
FileAttributes.ReadOnly;
File.SetAttributes( fname, File.GetAttributes( fname) & (~attr));
--
mikeb