8.9.9 IsNew (compare files for the more recent version or date)
- Purpose
-
Compares which of two files has the more recent version information or file date, and returns True or False.
- Syntax
IsNew (PathName1, PathName2 [, Option])
- Arguments
-
- PathName1
-
Specify the full path of the first file as a string or as a variable that stores this value.
- PathName2
-
Specify the full path of the second file as a string or as a variable that stores this value.
- Option
-
Specify either of the following options:
Value
Meaning
Version
Compare the version information only.
FileTime
Compare the file dates only.#
- Description
-
If you omit the Option argument, the IsNew command compares the version information of the two files. If no version information is available, the command compares the file dates. True is returned if the file specified in PathName1 is more recent than the file specified in PathName2. False is returned if the file specified in PathName1 is older or the same version or date as the file specified in PathName2.
If you specify the Option argument, the files are compared accordingly.
If an error occurs, the command returns a zero-length string ("").
- Note
-
Take care when specifying a file in the folder set in the environment variable ProgramFiles (normally the Program Files folder on the system drive) or WinDir (normally the Windows folder on the system drive). For details, see 1.8.3 Effect of the executing user on command behavior.
- Example
' Compare the version information of file1 and file2. ' If file1 is more recent than file2, copy information from ' file2 to file1. Dim file1, file2 file1 = _SCF_+"TEST.SPT" file2 = "C:\BKUP\TEST.SPT" If IsNew (file1, file2) = False Then Copy (file2, file1) End
- JP1/Script version
-
Supported from JP1/Script 05-10.