Get and Set Directory Creation Time Using VB.NET

In this article I describe how to get and set the creation time of directory in VB.Net.
  • 2376

Get and Set Directory Creation Time

  The Directory.SetCreationTime and Directory.GetCreationTime methods are used to set and get the creation date and time of the specified directory. The following code snippet sets and gets the creation time of a directory.

Imports System.IO
Module
Module1
    Sub Main()
        Dim root As String = "C:\Temp"
        ' Get and Set Creation time
        Directory.SetCreationTime(root, DateTime.Now)
        Dim creationTime As DateTime = Directory.GetCreationTime(root)
        Console.WriteLine(creationTime)
        Console.ReadLine()
    End
Sub

End
Module

 Output:

 directory creation time.jpg

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.