File System - Get File Checksum |
<AMCALCHASH FILE="Text" HASHTYPE="Text" RESULTVARIABLE="Text" /> |
Description:
Generates a hash (checksum) value for a file and places it into an existing 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.
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.
General
Property |
Type |
Required |
Default |
Markup |
Description |
File |
Text |
Yes |
(Empty) |
FILE="c:\folder\file.txt" |
The path and filename of the file to retrieve checksum information from. |
Checksum algorithm |
Text (options) |
No |
CRC |
|
The algorithm to use for calculation. Available algorithms are placed in order from quickest but least efficient to slowest but most efficient. The available options are:
|
Populate variable with the checksum |
Text |
No |
(Empty) |
RESULTVARIABLE="VarName" |
The name of an existing variable in which to populate with the checksum value. The variable must be created in a previous step using the Create variable activity. |
NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder. |
Description: Calculate the checksum of file "C:\Temp\extract.pdf" using the "MD5" algorithm and store the result in variable "theChecksum" then display the value in a message box.
<AMVARIABLE NAME="theChecksum" /> <AMFILESYSTEM ACTIVITY="get_checksum" FILE="C:\Temp\extract.pdf" RESULTVARIABLE="theChecksum" HASHTYPE="md5" /> <AMSHOWDIALOG WINDOWTITLE="Checksum">MD5 Checksum Value = %theChecksum%</AMSHOWDIALOG>
|