This is an old revision of the document!
Session.GetFiles Method
Downloads one or more files from remote directory to local directory.
Syntax
public OperationResult<TransferArgs> GetFiles( string remotePath, string localPath, bool remove = false, TransferOptions options = null )
Advertisement
Parameters
Name | Description |
---|---|
string remotePath | Full path to remote file or directory to download. Filename in the path can be replaced with wildcard to select multiple files. When file name is omited (path ends with slash), all files and subdirectories in the remote directory are downloaded. |
string localPath | Full path to download the file to. When downloading multiple files, the filename in the path should be replaced with operation mask or omited (path ends with backslash). |
bool remove | When set to true , deletes source remote file(s) after transfer. Defaults to false . |
TransferOptions options | Transfer options. Defaults to null , what is equivalent to new TransferOptions() . |
Return Value
OperationResult<T>
holding collection of TransferArgs
. See also Capturing results of operations.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | Session is not opened. |
ArgumentException ArgumentOutOfRangeException |
Invalid combination of values of TransferOptions properties. |
SessionException | Error communicating with winscp.com . |
TimeoutException | Timeout waiting for winscp.com to respond. |
Advertisement
Remarks
Event Session.FileTransferred
is raised for every downloaded file.