|
|
Title | Get a file's creation, last access, and last modification times using FSO |
Keywords | file times, modification time, access time, creation time |
Categories | Files and Directories, Windows, Software Engineering |
|
|
Thanks to Robert Terblanche.
This program contains a reference to the Microsoft Scripting Runtime library (Project\References menu).
At run time, the program creates a FileSystemObject and uses its GetFile method to make a File object corresponding to the target file. The File object's properties give the file's creation, modification, and access times.
|
|
Private Sub Command1_Click()
Dim FSO As New FileSystemObject
Dim mFile As File
' Get the file.
Set mFile = FSO.GetFile(Text1.Text)
' Get the dates.
lblCreated.Caption = Format$(mFile.DateCreated)
lblLastModified.Caption = _
Format$(mFile.DateLastModified)
lblLastAccessed.Caption = _
Format$(mFile.DateLastAccessed)
Set mFile = Nothing
Set FSO = Nothing
End Sub
|
|
|
|
|
|