PDA

Click to See Complete Forum and Search --> : Last Modified


HeSaidJoe
Dec 7th, 1999, 02:07 AM
I have a folder "Myfolder" and in it I have multiple files, say 10 for arguments sake.
Is there a function which will tell me last date modified...I am running a job which should change data in all files of MyFolder...sometimes it doesn't..

So I need to read the last date modified of all files in Myfolder and then send a message if one of the 10 doesn't have a modified date to match todays date.
Thanks,
Wayne

rreese
Dec 7th, 1999, 02:37 AM
here is a rounting using a filesystem object that is an easy way to get the timestamp. This uses the scrrun.dll if you are distributing this code to others in your program.

Sub ShowFileInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = "Created: " & f.DateCreated
MsgBox s
End Sub

rreese
Dec 7th, 1999, 02:39 AM
....there is alsow a DateLastModified property on this object that is probably closer to what you are looking for

Sub ShowFileAccessInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = UCase(filespec) & vbCrLf
s = s & "Created: " & f.DateCreated & vbCrLf
s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
s = s & "Last Modified: " & f.DateLastModified
MsgBox s, 0, "File Access Info"
End Sub