There is an 'Accessed' meta data which is shown as part of the properties window of a file.is there a programmatically way to delete this info or set it to something else?
Thank you
Asked
Active
Viewed 77 times
0

Avishay
- 305
- 1
- 11
-
https://stackoverflow.com/questions/17125382/changing-the-file-creation-date-does-not-work/17126045#17126045 – Dmitry Bychenko Jul 05 '18 at 10:16
2 Answers
1
The FileInfo
class can take care of this for you.
[TestMethod]
public void SetLastAccessTime()
{
String fileName = @"D:\Sample.txt";
FileInfo fi = new FileInfo(fileName);
fi.CreationTime = DateTime.Now.AddDays(10);
fi.LastWriteTime = DateTime.Now.AddDays(10);
fi.LastAccessTime = DateTime.Now.AddYears(-2);
}
And, this is what the file properties looks like after this code has run.

JayV
- 3,238
- 2
- 9
- 14
1
After a small search I found this in File.SetLastAccessTime Method
Haven't used it myself but according to MSDN you can set the Access time with this:
File.SetLastAccessTime

S.Fragkos
- 301
- 2
- 9