If - Compare Files

Declaration

<AMIF ACTIVITY="comparefiles" FILEA="text" FILEB="text" 
COMPARETYPE="text (options)" HASHTYPE="text (options)">

Description: Compares two files using the specified criteria and returns TRUE if the values match or FALSE if they don't. If the result evaluates to TRUE, the task will execute the block of steps immediately following this step up until an End if step is encountered. If the result evaluates to FALSE, the block will be skipped and execution will proceed directly after the End if step (or if an Else step is encountered, the task will execute that block of steps instead, up until an End if step is encountered).

Property Type

Required

Default

Markup

Description

File A

Text

Yes

(Empty)

FILEA="C:\Folder\FileA.txt"

The path and filename of the file to compare against the one specified in the File B parameter. Click the Folder icon and navigate to the desired file or enter the path and file name manually in the provided field.

File B

Text

Yes

(Empty)

FILEB="C:\Folder\FileB.txt"

The path and filename of the file to compare against the one specified in the File A parameter. Click the Folder icon and navigate to the desired file or enter the path and file name manually in the provided field.

Compare type

Text (options)

Yes

Size

COMPARETYPE="CRC"

The criteria to use when comparing the two files. The available options are:

  • CRC

  • MD5

  • SHA1

  • SHA256

  • SHA356

  • SHA512

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: Compare file "C:\temp1\log.txt" with file "C:\temp2\log.txt". Compare hash values. Use the MD5 algorithm. If hash values match, delete file(s) "C:\temp2\log.txt".

<AMIF ACTIVITY="comparefiles" FILEA="C:\temp1\log.txt" 
FILEB="C:\temp2\log.txt" COMPARETYPE="crc" 
 HASHTYPE="md5">
<AMFILESYSTEM ACTIVITY="delete" SOURCE="C:\temp2\log.txt" />
</AMIF>