checksum command
Calculates a checksum of a remote file.
Advertisement
Syntax
checksum <alg> <file>
Remarks
alg
is a name of a checksum algorithm to use. Use IANA name of algorithm or use a name of any proprietary algorithm the server supports (with SFTP protocol only). Commonly supported algorithms are sha-1
and md5
.
Supported with SFTP and FTP protocols, subject to support of respective protocol extension.
XML log element: checksum
Examples
checksum sha-1 index.html
Converting to .NET Assembly
When converting script to .NET Assembly, map checksum
command to Session.CalculateFileChecksum
method.
Parameters mapping: Command parameters alg
and file
maps to method parameters algorithm
and path
, respectively. You have to convert relative paths to absolute paths.
Advertisement
For example, the following script snippet:
cd /home/martinp/public_html checksum sha-1 index.html
maps to the following PowerShell code:
Write-Host ([System.BitConverter]::ToString($session.CalculateFileChecksum("/home/martinp/public_html/index.html")))