Session.PutFiles Method :: WinSCP

Uploads one or more files from local directory to remote directory.

You can have WinSCP generate a code template for Session.PutFiles for you.

The method is quite powerful, but due to a wide range of it uses, its syntax can be cumbersome initially. For specific tasks, consider using convenient alternatives: Session.PutFilesToDirectory and Session.PutFileToDirectory.

Advertisement

C#

public

TransferOperationResult

PutFiles

(

string

localPath,

string

remotePath,

bool

remove =

false

,

TransferOptions

options =

null

)

VB.NET

Public

Function

PutFiles

(

localPath

As

String

, remotePath

As

String

,

Optional

remove

As

Boolean

=

False

,

Optional

options

As

TransferOptions

=

Nothing

)

As

TransferOperationResult

Name
Description

string localPath
Full path to local file or directory to upload. Filename in the path can be replaced with Windows wildcard1 to select multiple files. To upload all files in a directory, use mask *.

string remotePath
Full path to upload the file to. When uploading multiple files, the filename in the path should be replaced with operation mask or omitted (path ends with slash).

bool remove
When set to true, deletes source local file(s) after a successful transfer. Defaults to false.

TransferOptions options
Transfer options. Defaults to null, what is equivalent to new TransferOptions().

Advertisement

Exception
Condition

InvalidOperationException
Session is not opened.

ArgumentException
ArgumentOutOfRangeException
Invalid combination of values of TransferOptions properties.

SessionLocalException
Error communicating with winscp.com.
See the exception documentation for details.

SessionRemoteException
Session has failed.
Uploading of files has failed.
See the exception documentation for details.

TimeoutException
Timeout waiting for winscp.com to respond.

Xổ số miền Bắc