I’d like to adjust the creation/last access/last modification property of a file. The Compact Framework’s FileSystemInfo class has fields that seem appropriate for these, but they are read only. While I’m modifying properties of the firl, I’d also like to mark the file as read-only to help prevent accidental deletion. What can the SDF do for me?
The OpenNETCF.IO.FileHelper class provides methods to alter all of these file properties (as well as simple methods for reading files without having to create streams first). Here is an example of how you could use the FileHelper:
string myFilePath = @”My Documentsmyfile.txt”;
// alter the file creation time
// make the file hidden and read-only
OpenNETCF.IO.FileHelper.SetAttributes(myFilePath, FileAttributes.Hidden | FileAttributes.ReadOnly);