Compare Two Files

Verb: hashCompare

Available from: <Standard>

Compares the contents of two files by checking their hash code equality, returning a boolean that either ratifies or denies their equality.

A hash function is an algorithm that maps variable length data to a fixed length data.

Syntax

hashCompare --filename1(String) --FileName2(String) [--type(HashType)] (Boolean)=value

Inputs

Script Designer Required AcceptedTypes Description
--filename1 First File Required Text Full path of the first file to refer to for equality comparison.
This file is compared to the file indicated by the parameter Second File.
--FileName2 Second File Required Text Full path of the second file to refer to for equality comparison.
This file is compared to the file indicated by the parameter First File.
--type Algorithm Optional HashType Type of hash function to be used for comparison, select from the following options:
  • CRC32
  • MD5
  • RIPMD160
  • SHA1
  • SHA256
  • SHA384
  • SHA512
  • Outputs

    Script Designer AcceptedTypes Description
    value Equality Boolean Returns "True" if the files are the same or "False" if the files are different.

    Example

    The command compares the two reported files and returns the result of the comparison: "True".

    defVar --name comparisonResult --type Boolean
    // Download the following files to run the command.
    hashCompare --filename1 "fileText.txt" --type "MD5" comparisonResult=value
    logMessage --message "Comparison Result: ${comparisonResult}" --type "Info"
    

    Download File


    For the script to work correctly, it is necessary to download the files and insert the path of the first in the First File parameter and the second in the Second File parameter of the Compare Two Files command.

    See Also

  • Calculate Hash
  • Check File