File Date Comparison Utility

   
Release: 2.0.0
Date: 20 July 2014
O/S: Windows 2000 and later

Overview

This console application compares the last modification dates of two files whose names are passed on the command line and returns an exit code that indicates the result.

The type of comparison required can be customised. The program can compare either the last modification date or the creation date of files. In the case of shortcut files either the date of the shortcut file itself or that of the file it references can be compared.

The usage is:

CompFileDate <filename1> <filename2> [options]
CompFileDate -h | -? | --help
CompFileDate -V | --version

where

<filename1>
Is the name of the first file to be compared.
<filename2>
Is the name of the second file to be compared.

Options are:

-c <op> or --compare=<op>

Defines the compare operation to use. <op> must be one of the following:

eq, equal, same
Check if the dates of the files are the same.
gt, newer, later
Check if the 1st file date is later than the 2nd file date.
gte, not-older, not-earlier
Check if the 1st file date is no earlier than the 2nd file date.
lt, older, earlier
Check if the 1st file date is earlier than the 2nd file date (default used if this option is not provided).
lte, not-newer, not-later
Check if the 1st file date is no later than the 2nd file date.
neq, not-equal, not-same, different
Check if the dates of the files are different.
-d <type> or --datetype=<type>

Determines whether the last modification or creation dates of the files are compared. <type> must be one of the following:

m, modified, last-modified, modification
Use the date the files were last modified (default used if the option is not provided).
c, created, creation
Use the date the files were created.
-s or --followshortcuts
Indicates that if either <filename1> or <filename> is a shortcut file then the date of the shortcut's target file will be used in comparisons. If neither option is specified then shortcuts are not followed and the date of the shortcut file itself is used in the comparison.
-v or --verbose
Verbose: writes output to standard output. No output is generated if this option is not provided. Output is always written when an error occurs or when help or the program's version number are requested.
-h or -? or --help
Displays a help screen. Any file names and other options are ignored.
-V or --version
Displays the program's version number on standard output and halts. Any file names and other options are ignored.

The program's exit code is 1 if the comparison is true and 0 if it is false.

If an error occurs then an error code >= 100 is returned and an error message is written to standard output. The error codes and their meanings are described in the following table.

CompFileDate Error Codes
Code Meaning
100 Unknown error detected.
101 An invalid command or option was supplied.
102 Incorrect number of file names supplied (two required).
103 Both file names were the same.
104 One or both file could not be found.
105 No comparison type was specified for the -c or --compare option.
106 An invalid comparison type was specified for the -c or --compare option.
107 No date type was specified for the -t or --datetype option.
108 An invalid date type was specified for the -t or --datetype option.