Calculate File Checksum

Declaration

<AMCALCHASH FILE="Text" HASHTYPE="Text" RESULTVARIABLE="Text" />

See Also

Split File | Move File | Create Folder | Delete File | Delete Folder | Rename Folder | Remove Folder | Touch File | Set Attributes | Read from File | Write to File | Synchronize Folders | Concatenate Files

File System - Get File Checksum

Declaration

<AMCALCHASH FILE="Text" HASHTYPE="Text" RESULTVARIABLE="Text" />

See Also

Change Folder | Concatenate Files | Copy | Create Folder | Delete | Get File(s) information | Join File | Read from File

Description

Generates a hash (checksum) value for a file and places it into the specified AutoMate variable. While CRC (Cyclical Redundancy Checking) is the default algorithm, this activity also supports MD5 (Message Digest 5) and several SHA (Secure Hash Algorithm) variants. Available algorithms are placed in order from quickest but least efficient to slowest but most efficient.

Practical Usage

Commonly used to validate the integrity of data by calculating a checksum using the selected algorithm. The result is placed in a variable, which can be stored for later validation of the file or compared with an earlier checksum to verify the file's integrity.

Parameters

General Properties

Property

Type

Req'd

Default

Markup

Description

File

Text

Yes

(Empty)

FILE="c:\folder\file.txt"

Specifies the path and file name of the file to check.

Checksum Algorithm

Text

 (Options)

No

CRC

HASHTYPE="MD5"

Indicates the algorithm to use during calculation. The available options are:

  • CRC (default): Cyclical Redundancy Checking. Fastest and least secure.

  • MD5: Message Digest 5. Slower and more secure than CRC.

  • SHA1: Secure Hash Algorithm-1. Slower and more secure than MD5.

  • SHA256: Secure Hash Algorithm-256. Slower and more secure than SHA1.

  • SHA384: Secure Hash Algorithm-384. Slower and more secure than SHA256.

  • SHA512: Secure Hash Algorithm-512. Slowest and most secure.

Populate Variable with the Checksum

Text

No

(Empty)

RESULTVARIABLE="VarName"

Specifies the name of an existing AutoMate variable in which to populate with the checksum result. The variable must be created in a previous step using the Create Variable action.

 

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: Calculate the checksum of file "C:\FolderName\FileName.doc" using the "MD5" algorithm and store the result in variable "VariableName".

 

<AMCALCHASH FILE="C:\FolderName\FileName.doc" HASHTYPE="MD5" RESULTVARIABLE="VariableName" />

 

↑ Top of Page