<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > FIL. - File-Commands > FIL. - File-Commands |
MiniRobotLanguage (MRL)
FIL.Compare
Compare two files including their content
Intention
This command is used to compare two files "Byte by Byte" for equality.
If both files are equal, the result is 1, otherwise the result is zero.
The command checks these files for existence, if any of the files does not exist, the result is 0.
If one of the given Parameters evaluates to a folder the result is zero.
Usage of the command is simple:
' $$FIA - File 1
' $$FIA - File 2
' $$RES - Variable mit Ergebnis
FIL.Compare|$$FIA|$$FIB|$$RES
If P3 is missing, the result will be placed on the TOS.
' $$FIA - File 1
' $$FIA - File 2
'
FIL.Compare|$$FIA|$$FIB
MBX.$tos$
Syntax
FIL.Compare|P1|P2[|P3]
Parameter Explanation
P1 - Filename for file 1
P2 - Filename for file 2
P3 - (optional) Variable for the result. The result will be 0 or 1.
In case the files compute as identical, the result is 1.
If the files are computed as "non identical", do not exist, or if there are errors,
the result is zero.
Example
'*****************************************************
' EXAMPLE 1: FIL.Compare
' Save as "Tests.mrt"
'*****************************************************
$$FIA=?path\Tests.mrt
$$FIB=?path\Identic.txt
$$FIC=?path\False.txt
CFF.$$FIA|$$TXT
' Make an equal File thats identical
CTF.$$FIB|$$TXT
' Make a file that differs at Byte Position 10
STR.PATCH|$$TXT|10|1|Ä
CTF.$$FIC|$$TXT
FIL.Compare|$$FIA|$$FIB|$$RES
GSB.resul
FIL.Compare|$$FIA|$$FIC|$$RES
GSB.resul
ENR.
'-----------------------------------------------------------
:resul
IVV.$$RES=1
MBX. The files are identical.
ELS.
MBX. The files are NOT identical!
EIF.
RET.
'-----------------------------------------------------------
Remarks
-
Limitations:
If both of the given Parameters evaluate to a folder that exists, the result is 1.
In this case there is no binary compare of the content.
This command does not compare folders. It should only be used on files.
See also:
• IEF. / NEF. - If - exist - File