filecompare

Compares the size, date, or CRC32 value of two given files.
[filecompare method=size&file1=bigimage.png&file2=smallimage.png


Parameters

ParameterDescription
methodsize or date or CRC32
file1The path to the first file, including the name of the file.
file2The path to the second file, including the name of the file.
file1crcArbitrary CRC32 value, in place of an actual path for file1. This is useful if you want to store the CRC32 value of a file and use it at a later time to test if the file contents have been changed.

CRC32 is a 32-bit Cyclic Redundancy Check code, used mainly as an error detection method during data transmission. If the computed CRC bits are different from the original (transmitted) CRC bits, then there has been an error in the transmission. If they are identical, it can be assumed that no error occurred (there is a chance 1 in 4 billion that two different bit streams have the same CRC32). The idea is that the data bits are treated as a data polynomial and the CRC bits represent the remainder of the division of the data polynomial by a fixed, known polynomial (called the CRC polynomial).

Example WebDNA code:
[filecompare method=size&file1=bigimage.png&file2=smallimage.png]
Results will be one of the following:
SMALLER - file2 is smaller than file1
LARGER - file2 is larger than file1
SAME - file1 and file2 are the same size

Example WebDNA code:
[filecompare method=date&file1=bigimage.png&file2=smallimage.png]
Results will be one of the following:
OLDER - file2 is older than file1
NEWER - file2 is newer than file1
SAME - file1 and file2 have the same create date

Example WebDNA code:
[filecompare method=CRC32&file1=bigimage.png&file2=smallimage.png]
Results will be one of the following:
DIFFERS - the files differ in content
SAME - the files have the same content

Errors are displayed as such:
ERROR_FILE1 - 'file1' could not be found or opened
ERROR_FILE2 - 'file2' could not be found or opened
ERROR_BOTH - neither file could be found or opened