Mega Code Archive
Returns the date and time the specified file or directory was last written to
Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
Try
Dim path As String = "c:\MyDir"
If Directory.Exists(path) = False Then
Directory.CreateDirectory(path)
Else
Directory.SetLastWriteTime(path, New DateTime(2010, 4, 3))
End If
Dim dt As DateTime = Directory.GetLastWriteTime(path)
Console.WriteLine("The last write time for this directory was {0}", dt)
Directory.SetLastWriteTime(path, DateTime.Now)
dt = Directory.GetLastWriteTime(path)
Console.WriteLine("The last write time for this directory was {0}", dt)
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub
End Class