download Method
Download a RemoteFile from an SCP server.
Syntax
def download() -> None: ...
Remarks
The remote file specified by remote_file is downloaded to the local file specified by local_file, or it is retrieved through the on_transfer event, if the local_file property is "" (empty string). remote_file is an absolute or relative path on the server.
If there is no SSH session in place, one is automatically created by the component first.
Example
SCPControl.Localfile = "C:\localfile.txt" SCPControl.RemoteFile = "remotefile.txt" SCPControl.Download() SCPControl.Localfile = "C:\localfile2.txt" SCPControl.RemoteFile = "folder/remotefile2.txt" SCPControl.Upload()
Multiple file uploads and downloads are supported through the use of filemasks.
To upload files matching a filemask set local_file to a local path including a filemask. Set remote_path to the directory on the server where the files will be uploaded. In this case remote_file is ignored. All matching files will be upload when upload is called. The on_start_transfer, on_transfer, and on_end_transfer events provide details about the individual file transfers.
To download files matching a filemask set remote_file to a filemask. The path may be specified as part of the value in remote_file or may be set separately in remote_path. local_file should be set to a local directory where files will be downloaded. When download is called all matching files are downloaded. The on_start_transfer, on_transfer, and on_end_transfer events provide details about the individual file transfers. In the event an individual file fails to transfer the on_error event will fire.