This is an old revision of the document!
Session.CalculateFileChecksum Method
Calculates a checksum of a remote file. This feature is available only in the latest beta release.
Advertisement
Syntax
C#
public byte[] CalculateFileChecksum(string algorithm, string path)
VB.NET
Public Function CalculateFileChecksum(ByVal algorithm As String, ByVal 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.
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. |
Advertisement
Remarks
Supported with SFTP and FTP protocols, subject to support of respective protocol extension.