Update Directory: create time, last access time and last write time
Imports System.IO
Module Module1
Sub Main()
If (Directory.Exists("C:\WINNT\Temp")) Then
Dim Dir As New DirectoryInfo("C:\WINNT\Temp")
Dim DateTimeNow As DateTime = DateTime.Now()
Try
Dir.CreationTime = DateTimeNow
Dir.LastAccessTime = DateTimeNow
Dir.LastWriteTime = DateTimeNow
Console.WriteLine("Directory attributes updated")
Catch E As Exception
Console.WriteLine("Error updating attributes")
Console.WriteLine("Error {0}: ", E.Message)
End Try
Else
Console.WriteLine("C:\WINNT\Temp does not exist")
End If
End Sub
End Module
Related examples in the same category