Forums  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Member List  Search  FAQ  Ticket List  Log Out

 

CheckFileDate

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Networking & Security] >> GFI Network Server Monitor >> CheckFileDate Page: [1]
Login
Message << Older Topic   Newer Topic >>
CheckFileDate - 21.Jul.2004 4:42:00 AM   
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
Post #: 1
RE: CheckFileDate - 8.May2007 1:30:13 PM   
ecarlson

 

Posts: 1
Joined: 7.May2007
Status: offline
Thanks. I modified it a little to go by minutes instead of days, and to include the difference value in the Explanations. I use it with LANguard NSM to make sure that an application's log file is being updated regularly (the Modified date is not more than 30 minutes old). I can post the update if anyone is interested.

(in reply to edgein)
Post #: 2
RE: CheckFileDate - 2.Jul.2009 4:35:00 AM   
pjgfi

 

Posts: 53
Joined: 7.Jan.2008
Status: offline
Thanks for this script, it was exactly what I was looking for !

(in reply to ecarlson)
Post #: 3
Page:   [1]
All Forums >> [Networking & Security] >> GFI Network Server Monitor >> CheckFileDate Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts