Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a file's last modified date in VB6

Tags:

vb6

How do you get any file's last modified date using VB6?

like image 315
Keith Maurino Avatar asked Nov 02 '09 16:11

Keith Maurino


People also ask

How do I find the last modified date of a file?

lastModified() method: It contains a method called lastModified() which returns the last modified date of a file or directory in form of a long millisecond epoch value, which can be made readable using format() method of SimpleDateFormat class.

How do I get the last modified date of a file in VB NET?

File. GetCreationTime returns the creation date and time of the specified file or directory. File. GetLastAccessTime returns the date and time the specified file or directory was last accessed.

How do I change the date a folder was last modified?

Launch BulkFileChanger, select File from the menu bar, and choose Add Files. Now, you can select the folder or file you want to use. You should see it on the list inside the app's main window. To initiate the changes, click on Actions in the menu bar and choose “Change Time/Attributes.” The keyboard shortcut is F6.

Can you change the last modified date on a file?

Unfortunately, this isn't possible. You can view certain and change certain file attributes in File Explorer, but you can't change the last viewed, edited, or modified dates.


2 Answers

There is a built in VB6 function for that - no need for FSO (although FSO is great for more advanced file operations)

From http://msdn.microsoft.com/en-us/library/aa262740%28VS.60%29.aspx

Dim MyStamp As Date
MyStamp = FileDateTime("C:\TESTFILE.txt")
like image 111
DJ. Avatar answered Oct 18 '22 01:10

DJ.


Add a reference to the Microsoft Scripting Runtime (Project->References...) and use the following code:

Dim fso As New FileSystemObject
Dim fil As File

Set fil = fso.GetFile("C:\foo.txt")
Debug.Print fil.DateLastModified
like image 21
raven Avatar answered Oct 18 '22 02:10

raven