XenoGuard 4.0 Documentation

Compare

ActionStep Reference » Windows » File » Compare 

The ActionStep File Compare matches two files according to their file name, creation time, and hash value. The comparison of the two files results in a Boolean value.


[-] Hide
  1. Open the Windows node in the Workspace Explorer.
  2. Open the File node, select the Compare ActionStep.

Parameters:

The ActionStep has the following input parameters:


name Description
Source Path Name
The path name of a file to be compared.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Enum]
Target Path Name
The path name of a file to be compared to.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter, Enum]
Compare File Name
Determines whether the name of the file shall be compared.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Value [Boolean]
Compare Time
Determines whether the time in which the files were created shall be compared.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Value [Boolean]
Compare Hash Value
Determines whether the hash value of the files shall be compared.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Value [Boolean]

Results:

The ActionStep returns the following results:


name
description
Result
Displays a boolean value after comparing the two files.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Value 
[Boolean]
Time Comparision
An integer value indicating whether the compared files were created at the same time or not.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Value [Signed Number]
Source File
Displays information about the source file in the sub-branches.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter]
Target File
Displays information about the target file in the sub-branches.

Allowed Context Scopes [Fixed, Local, Global]
Allowed Context Types [Variable, Parameter]

Information The Time Comparison parameter results in a negative value (-1) if the source file is created earlier than the target file, a zero value (0) if the files were created at the same time, and a positive value (1) if the source file is created later than the target file.
Information The Source File and Target File sub-branches include "Path File", "File Size [KB]", "File Hash Value", and "Creation Time".

Example 1 (Compare the hash values from two files):

This example runs a match check on the hash value of the files stored in the two local variables named Source File and Target File with Text as data type. The Result after comparing the hash values was passed to the If flow control statement. The ActionStep in the "Then" branch is executed if the Result is equal to true and output via Message Box, otherwise the ActionStep in the "Else" branch is executed.

Example 2 (Compare the file versions based on creation time):

This example checks the file versions based on the creation time of the two files. The path name of the files is stored in the two local variables, Source File and Target File with Text as data type. The ActionStep in the "Then" branch is executed if the Time Comparison is less than zero (0) and output via Message Box, otherwise, the ActionStep in the "Else" branch is executed.

See other File operations: