home *** CD-ROM | disk | FTP | other *** search
- // FCOMPARE.SCP - Sample Script which compares file attributes.
- // Copyright (c) 2001-2002, Vector Networks Limited.
- // All Rights Reserved
- //
- // Revision History:
- // 7.0 20-Mar-02 DB - Separated from GRPFLUPD.SCP.
-
- // This function compares two files to check for differences. If the files have the same
- // size, date, and time, the function returns 0. If one of these is different from
- // the other file, a number between 1 and 4 is returned, depending on the value that is
- // different. If one or both of the files don't exist, 5 is returned.
-
- Function FileCompare (File1 as String, File2 as String) as Integer
- Dim a as Integer, b as Integer
- Dim c as String, d as String
-
- Print "Comparing files : ", File1, " and ", File2
-
- FileCompare = 0
-
- If FileExists (File1) and FileExists (File2) Then
- a = GetFileInfo (File1, FI_SIZE)
- b = GetFileInfo (File2, FI_SIZE)
- If (a = b) Then
- a = GetFileInfo (File1, FI_DATE)
- b = GetFileInfo (File2, FI_DATE)
- If (a = b) Then
- a = GetFileInfo (File1, FI_TIME)
- b = GetFileInfo (File2, FI_TIME)
- If (a = b) Then
- c = GetFileInfo (File1, FI_ATTRIB)
- d = GetFileInfo (File2, FI_ATTRIB)
- If (c = d) Then
- Print "The files are the same."
- Else
- Print "The file attributes are different"
- FileCompare = 1
- Endif
- Else
- Print "The files have different time stamps."
- FileCompare = 2
- Endif
- Else
- Print "The files have different dates"
- FileCompare = 3
- Endif
- Else
- Print "The files are different sizes."
- FileCompare = 4
- Endif
- Else
- Print "One (or both) of the files does not exist."
- FileCompare = 5
- Endif
- End Function
-