Table of Contents

Method CopyFileAsync

Namespace
SshSharp.Sftp
Assembly
SshSharp.dll

CopyFileAsync(string, string, bool, CancellationToken)

Copies sourcePath to destinationPath on the server (copy-data): the data never travels through this machine. The destination is created, or with overwrite replaced.

public Task CopyFileAsync(string sourcePath, string destinationPath, bool overwrite = false, CancellationToken cancellationToken = default)

Parameters

sourcePath string
destinationPath string
overwrite bool
cancellationToken CancellationToken

Returns

Task

Nothing; the copy is complete when this returns.

Exceptions

NotSupportedException

The server lacks copy-data; download and upload instead.

SftpException

The destination is the source itself (Failure), or another error.