SFTP Get

The SFTP Get activity issues an SFTP get and mget command to the specified server. The content of the remote files can be placed in the activity’s output or written directly to local storage. If you choose to place the contents of a remote file into the activity’s output, you can only retrieve one remote file (SFTP get command) and the file’s content will be stored in memory as part of the activity’s output. If you choose to write the contents of the retrieved files to local storage, you can retrieve one or more files (SFTP get and mget commands).

Note: Using the SFTP Get activity, you can copy the directories and subdirectories including all files from the source machine to the destination machine.

General

The General tab has the following fields.

Field Literal Value/Module Property Visual Difference? Description
Name No Yes The name to be displayed as the label for the activity in the process.
SFTP Connection Yes Yes

The path to the shared configuration resource containing the user information such as Host, Port, and User Name, Private Key or Password, and Known Host File.

For configuration details, refer to SFTP Connection.

Quit (post-command) No Yes When this check box is selected, it specifies that the SFTP Connection should be closed after completing this command.

If this check box is not selected, the SFTP Connection remains open so that all SFTP activities specifying the same SFTP Connection, (that is, the same host, port, and username) share the existing SFTP session until the connection is closed.

Use Process Data No Yes

Specify to write contents of the file retrieved from the SFTP server to the process data. The activity’s output includes an element that contains the remote file’s contents, and the data can be used by subsequent activities in the process. When this check box is selected, you can retrieve only one file from the remote server.

Important: You must select this check box to allow the sFTP Get activity to work in TIBCO® Cloud Integration. It is recommended not to specify wildcards in the RemoteFilename input element when this check box is selected.
Warning: Do not use this option if you are retrieving multiple files. You can only write the contents of one file to this activity’s output. It is recommended not to specify wildcards in the RemoteFilename input element when this check box is selected.
Binary No Yes Specifies whether to retrieve the file content in the binary or ASCII mode (selected signifies binary). When the ASCII mode is used, differences inline endings between the SFTP server and the machine executing the SFTP command are automatically handled. Also, the ASCII mode implies text data, and that data can be encoded in a character encoding other than the ASCII(such as UTF-8 or Latin-1).
Overwrite Existing File No Yes

If selected, any existing local files are overwritten if the SFTP command returns files with the same names.

If this check box is not selected, any attempt to write a file to disk with the same name as an existing file throws an exception.

This check box option is disabled when the Use Process Data check box is selected.

Persist Timestamp while Copy File No Yes Selecting this check box specifies that the original time stamp of file persists while transferring the original/source file from the remote machine to the local machine.

Description

In the Description tab, you can enter a short description for the SFTP Get activity.

Input

The following is the input for the activity.

Input Item Datatype Description
RemoteFilename string

The path and name of the file to retrieve from the remote server. Wildcards (? for any one character, * for one or more characters) are permitted in this field.

Use more specific wild cards that result into a file name, such as, *.txt or *.pdf.

Note: Do not specify wildcards for this element, if the Use Process Data check box is selected.
LocalFileName string

This input item specifies the name and path of the local file where the contents of the retrieved file should be written.

Note: This input item is not available when the Use Process Data check box on the General tab is selected.

If more than one remote file is retrieved, the local files are named to match the remote file names.

Host string The name or IP of the SFTP server. This overrides the value specified in the SFTP Connection shared resource.
Port integer The port number for incoming SFTP requests on the SFTP server. This value overrides the value specified in the SFTP Connection shared resource.
UserName string The username for logging into the SFTP server. This overrides the value specified in the SFTP Connection shared resource.
Password password The password for logging into the SFTP server. This overrides the value specified in the SFTP Connection shared resource.
PrivKey string The private key’s absolute or relative path to authenticate your login. This overrides the value specified in the SFTP Connection shared resource.
PrivKeyPass password

The password of the private key, if using the PrivKey authentication or two factor authentication method to log on to SFTP server. This overrides the value specified in the SFTP Connection shared resource.

Proxy Host string Specifies the host name or IP address of the proxy server.
Proxy Port integer Specifies the port number of the proxy server.
Proxy User Name string Specifies the user name used to connect to the proxy server, if necessary.
Proxy Password password

Specifies the password for the specified user name when connecting to the proxy server, if necessary.

Timeout integer The amount of time to wait for the SFTP server to respond. This timeout is used when the SFTP server places the SFTP connection used by this activity into a waiting state.

This overrides the value specified in the SFTP Connection shared resource. Input Item is Datatype.

Output

The following is the output for the activity.

Output Item Datatype Description
Files Transferred complex

When one or more remote files are retrieved and written to local storage, this element contains a list of the remote filenames that were retrieved. This element contains two elements: Name and NumOfBytes.

This element contains the name of the remote file that is retrieved. It contains two elements: Name and NumOfBytes.

If an error happens while retrieving a file, the activity output is not available. However, the Fault tab lists the successfully transferred files and the files that failed to be transferred.

ASCII data or Binary data string Available only when Use Process Data check box is selected.
Name string The name of the retrieved remote file.
NumOfBytes integer The number of bytes contained in the associated file name.

Fault

The Fault tab lists the possible exceptions that can be thrown by this activity.

Exception When Thrown..
GetFilesException An error occurs during the SFTP get operation.
ConnectionErrorException An error occurs when connecting to the SFTP server.
CommandExecutionException An error occurs when executing the SFTP command.
ConnectionTimeoutException The connection to the SFTP server times out before completing the command execution.