Get and Set Directory Last Access Time Using VB.NET
In this article I describe how to get and set the last access time of directory in VB.Net.
Get and Set Directory Last Access Time
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.
Imports System.IO
Module Module1
Sub Main()
Dim root As String = "C:\Temp"
' Get and Set Last Access time
Directory.SetLastAccessTime(root, DateTime.Now)
Dim lastAccessTime As DateTime = Directory.GetLastAccessTime(root)
Console.WriteLine(lastAccessTime)
Console.ReadLine()
End Sub
End Module
Output: