Technical References - [filecompare]

Compares the size, date, or CRC32 value of two given file

numero = 217
interpreted = N
texte = [filecompare params...] Putting [filecompare params...] in your template compares the size, date, or CRC32 value of two given files. Optional Tag Parameters: · method - Size | Date | CRC32 · file1 - path of first file. · file2 - path of second file. · file1crc - arbitrary crc32 value, in place of an actual path for file1. (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, we can assume that no error occured (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).

results: method=Size SMALLER - file2 is smaller than file1 LARGER - file2 is larger than file1 SAME - file1 and file2 are the same size results: method=Date OLDER - file2 is older than file1 NEWER - file2 is newer than file1 SAME - file1 and file2 have the same create date results: method=CRC32 DIFFERS - the files differ in content SAME - the files have the same content Errors: 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 Examples:
[filecompare method=SIZE&file1=../create_tutorial.tpl&file2=../header.inc][filecompare method=DATE&file1=../create_tutorial.tpl&file2=../header.inc][filecompare method=CRC32&file1=../create_tutorial.tpl&file2=../header.inc][text]crc_value=[CalcFileCRC32 file=../header.inc][/text][filecompare method=CRC32&file1crc=[crc_value]&file2=../header.inc]
Results: LARGER OLDER DIFFERS SAME [filecompare params...]

Putting [filecompare params...] in your template compares the size, date, or CRC32 value of two given files.

Optional Tag Parameters:

· method - Size | Date | CRC32
· file1 - path of first file.
· file2 - path of second file.
· file1crc - arbitrary crc32 value, in place of an actual path for file1. (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, we can assume that no error occured (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).



results: method=Size
SMALLER - file2 is smaller than file1
LARGER - file2 is larger than file1
SAME - file1 and file2 are the same size

results: method=Date
OLDER - file2 is older than file1
NEWER - file2 is newer than file1
SAME - file1 and file2 have the same create date

results: method=CRC32
DIFFERS - the files differ in content
SAME - the files have the same content

Errors:
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

Examples:

[filecompare method=SIZE&file1=../create_tutorial.tpl&file2=../header.inc]
[filecompare method=DATE&file1=../create_tutorial.tpl&file2=../header.inc]
[filecompare method=CRC32&file1=../create_tutorial.tpl&file2=../header.inc]

[text]crc_value=[CalcFileCRC32 file=../header.inc][/text]
[filecompare method=CRC32&file1crc=[crc_value]&file2=../header.inc]

Results:

LARGER
OLDER
DIFFERS
SAME

DOWNLOAD WEBDNA NOW!

Top Articles:

Download WebDNA Applications

WebDNA applications...

WebDNA Modules

A list of the currently available modules...

F.A.Q

A compilation of some user's questions...

Tips and Tricks

A list of user-submitted tips ...

WebDNA Libraries

A list of available libraries for WebDNA...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Related Readings:

[time]

Putting [time] in your template displays the current time set on your web server's clock...

[calcfilecrc32]

calculates the CRC32 value of a given file...

[format]

To apply formats for Dates or Times other than the current date and time...

[xmlnode]

...

[exclusivelock]

Prevents other threads from simultaneously accessing a group of databases...

[listfiles]

When listing files...