Changing File Attributes in CF

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top