Changing File Attributes in CF

  • Thread starter Thread starter Ayronski
  • Start date Start date
A

Ayronski

As the convenient File.SetAttribute() and File.GetAttribute() do not
exist in the compact framework, I thought I'd share another method of
changing file attributes using FileInfo:

FileInfo fileInf = new FileInfo(myFilePath);

if ((fileInf.Attributes & FileAttributes.ReadOnly) ==
FileAttributes.ReadOnly)
{
fileInf.Attributes = FileAttributes.Normal;
}

HTH.

-ak
 
Back
Top