Skip to content

Latest commit

 

History

History
65 lines (61 loc) · 1.97 KB

sftp_download.md

File metadata and controls

65 lines (61 loc) · 1.97 KB

SftpDownload

Download a file via SFTP.

Parameters

Parameters Explanation Required Default Remarks
host Host name or IP address of a sftp server. Yes None
user User name for authentication Yes None
password Password for authentication No None Either password or key is required
key Path to key for authentication No None
passphrase Used for decrypting key No None
port Port number of a sftp server No 22
src_dir Directory of source to download Yes None
src_pattern File pattern of source to download. Regexp is available. Yes None
dest_dir Destination directory to download. No "." If a non-existent directory path is specified, the directory is automatically created.
timeout Timeout period of sftp connection. Unit is seconds. No 30
retry_count Retry count of sftp connection. No 3
quit True or False flag for quitting cliboa process when source files do not exist. No False
endfile_suffix Download a file only if "filename + endfile_suffix" exists No None
ignore_empty_file If True, size zero files are not be downloaded No False

Examples

scenario:
- step: Download a csv file from localhost under /tmp
  class: SftpDownload
  arguments:
    host: localhost
    user: root
    password: password
    src_dir: /root
    src_pattern: *\.csv
    dest_dir: /tmp

- step: Download a tsv file from 127.0.0.1 under /usr/local
  class: SftpDownload
  arguments:
    host: 127.0.0.1
    user: root
    key: ~/.ssh/id_rsa
    src_dir: /root
    src_pattern: *\.tsv
    dest_dir: /usr/local
    timeout: 100
    retry_count: 10
    quit: True

- step: Embed contents of key at scenario.yml
  class: SftpDownload
  arguments:
    host: 127.0.0.1
    user: root
    key:
      content: |
        -----BEGIN RSA PRIVATE KEY-----
        .......
        -----END RSA PRIVATE KEY-----
    passphrase: 1234
    src_dir: /root
    src_pattern: *\.tsv
    dest_dir: /usr/local
    timeout: 100
    retry_count: 10
    quit: True