The SetLastAccessTime and GetLastAccessTime methods are used to set and get the last access date and time of the specified directory. The following code snippet sets and gets the last access date and time of a directory.
string root = @"C:Temp"; // Get and Set Last Access time Directory.SetLastAccessTime(root, DateTime.Now); DateTime lastAccessTime = Directory.GetLastAccessTime(root); Console.WriteLine(lastAccessTime);