View Single Post
  #2 (permalink)  
Old August 6th, 2009, 02:47 PM
Old Pedant Old Pedant is offline
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Do you mean the *exact* names of the files are as you gave them or only that the file names will *end* like that? That is, will the file be "_full.xml" or could it be "whatever_full.xml"??

If the file names are exact, it's a trivial change to what you have there:
Code:
Option Explicit

'* DEFINE CONSTANTS
Const EVENT_ERROR = 1
Const EVENT_INFORMATIONAL = 4

'* DECLARE VARIABLES

Dim objShell
Dim FSO, File1, File2

'* Set environment and open output file

' why do you create this until you need it?
Set objShell = WScript.CreateObject("WScript.Shell")

set FSO = CreateObject("Scripting.FileSystemObject")

Dim match : match = False
If FSO.FileExists("c:\test\_single.xml") AND FSO.FileExists("c:\test\_full.xml") Then
    ' the two files at least exist...when were the modified?
    Set File2 = FSO.GetFile("c:\test\_single.xml")
    Set File2 = FSO.GetFile("c:\test\_full.xml")

    If DateDiff("s",File1.DateLastModified,Now()) <= 300 _
       AND DateDiff("s",File2.DateLastModified,Now()) <= 300 _
    Then 
        match = True
    End If
End If
If Not match Then
    objShell.LogEvent EVENT_ERROR, "One or both files have not been written to within the last 5 minutes"
End if

'
Reply With Quote