Get and Set Directory Last Write Time Using VB.NET

In this article I describe how to get and set the last write time of directory in VB.Net.
  • 2662

Get and Set Directory Last Write Time

The SetLastWriteTime and GetLastWriteTime methods are used to set and get the last write date and time of the specified directory. The following code snippet sets and gets the last write date and time of a directory.

Imports System.IO
Module
Module1
    Sub Main()
        Dim root As String = "C:\Temp"
        ' Get and Set Last Write time
        Directory.SetLastWriteTime(root, DateTime.Now)
        Dim lastWriteTime As DateTime = Directory.GetLastWriteTime(root)
        Console.WriteLine(lastWriteTime)
        Console.ReadLine()
    End
Sub

End
Module

Output:

 last write time of directory.jpg

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.