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.
  • 2550

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:

 directory access time.jpg

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.