edgein
Posts: 3
Joined: 20.Jun.2004
From: Sweden
Status: offline
|
Here is a little script which monitors the date of a file.
The function uses two arguments, strPath (path to the file) and intDaysOld (number of "days old" the file may be).
code:
Function CheckFileDate( strPath, intDaysOld )
On Error Resume Next
Dim objFSO, objFile
CheckFileDate = retvalUnknown ' Unless indicated otherwise
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(strPath) If( Err.Number <> 0 ) Then EXPLANATION = "Unable to retrieve filedate" Else If( objFile.DateLastModified > now-intDaysOld ) Then EXPLANATION = "File date is OK; date=[" & objFile.DateLastModified & "], limit=[" & intDaysOld & " days]" CheckFileDate = True Else EXPLANATION = "File date is exceeding the limit; date=[" & objFile.DateLastModified & "], limit=[" & intDaysOld & " days]" CheckFileDate = False End If End If
End Function
Cheers /Bj÷rn
|