How To Get File Last Updated Time Using VB.NET

This article describes how to get file last updated time.
  • 5439

File Last Updated Time

The LastWriteTime property returns the DateTime when a file was last updated or written. The following code snippet returns the last write time of a file.

Imports System.IO

Module Module1

    Sub Main()

        Dim fileName As String = "C:\Temp\MaheshTXFI.txt"

        Dim fi As New IO.FileInfo(fileName)

        Dim exists As Boolean = fi.Exists

        ' File ReadOnly ?

        Dim updatedTime As DateTime = fi.LastWriteTime

        Console.WriteLine("Last write time: {0}", updatedTime)


    End Sub

End Module


last write time of file.jpg


More Articles

© 2020 DotNetHeaven. All rights reserved.