The SetLastAccessTime and GetLastAccessTime methods are used to set and get the last access date and time of the specified file. The following code snippet sets and gets the last access date and time of a file.
// Get and set file last access time
string fileName = @"c:\temp\Mahesh.txt";File.SetLastAccessTime(fileName, DateTime.Now);DateTime dt = File.GetLastAccessTime(fileName);
Free Book
Download Complete free book here: Working with Directories in C#