Session.CalculateFileChecksum Method

Calculates a checksum of a remote file.

Syntax

C#
public byte[] CalculateFileChecksum(string algorithm, string path)
VB.NET
Public Function CalculateFileChecksum(algorithm As String, path As String) As Byte()

Parameters

Name Description
string algorithm 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.
string path A full path to a remote file to calculate a checksum for.

Return Value

An array containing the checksum.

Advertisement

Exceptions

Exception Condition
InvalidOperationException Session is not opened.
SessionLocalException Error communicating with winscp.com.
See the exception documentation for details.
SessionRemoteException Session has failed.
Checksum algorithm specified is not supported.
Calculating checksum has failed.
See the exception documentation for details.
TimeoutException Timeout waiting for winscp.com to respond.

Remarks

Supported with SFTP and FTP protocols, subject to support of respective protocol extension.

Examples

Real-Life Examples

Last modified: by martin