# Get a file with SFTP

### Description

The `Get a file with SFTP` action retrieves one or more files from an FTP server using the Secure FTP protocol.

The action returns true if the specified file(s) or pattern were retrieved successfully, false it there were problems retrieving the file(s).

{% hint style="info" %}
Tip: If you run into a `Algorithm Negotiation Fail` error when connecting to your SFTP server, check the [Algorithm Negotiation Fail Error](#negotiation_error) section at the end of this page.
{% endhint %}

### Options

#### General tab

| Option                | Description                                                                                                                                                                                                                                                                           |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Action name           | The name of the workflow action.                                                                                                                                                                                                                                                      |
| SFTP-server name / IP | The name of the SFTP server or the IP address                                                                                                                                                                                                                                         |
| Port                  | The TCP port to use. This is usually 22                                                                                                                                                                                                                                               |
| User name             | The user name to log into the SFTP server                                                                                                                                                                                                                                             |
| Password              | The password to log into the SFTP server                                                                                                                                                                                                                                              |
| Use private keyfile   | Indicates whether or not a private keyfile is to be used.                                                                                                                                                                                                                             |
| Private key filename  | If *Use private keyfile* is checked then this field is enabled. The file can be browsed to using the browse button to the right of the field. The Private Key should be in the PEM file format. For PuTTY-based Private Keys, use PuTTYgen to convert the file into "OpenSSH" format. |
| Key passphrase        | If *Use private keyfile* is checked then this field is enabled. If a passphrase is required then enter it here.                                                                                                                                                                       |
| Proxy type            | <p>The type of proxy to use for the connection. The available options are:</p><ul><li>blank (no proxy, default)</li><li>HTTPS</li><li>SOCKS5</li></ul>                                                                                                                                |
| Proxy host            | The proxy host to use for the connection                                                                                                                                                                                                                                              |
| Proxy username        | The proxy username to use for the connection                                                                                                                                                                                                                                          |
| Proxy password        | The proxy password to use for the connection                                                                                                                                                                                                                                          |
| Compression           | <p>The compression to use for this SFTP connection. The available options are</p><ul><li>none (default)</li><li>zlib</li></ul>                                                                                                                                                        |

#### Files tab

<table><thead><tr><th>Option</th><th>Description</th></tr></thead><tbody><tr><td>Source files</td><td></td></tr><tr><td>Copy previous results to args</td><td>If files to send are dynamically generated by another pipeline or if you want to identify files to sent, check this option. Hop will select files list from previous result rows (not result files) and send theses files.</td></tr><tr><td>Remote Directory</td><td>The remote directory on the SFTP server from which we get the files. Use the "test folder" button to connect to the remote server and validate that the folder exists.</td></tr><tr><td>Wildcard (regular expression)</td><td><p>Specify a regular expression here if you want to select multiple files. For example:</p><pre class="language-bash"><code class="lang-bash">.*txt$   : get all text files
A.*[ENG:0-9].txt  : files tarting with A, ending with a number and .txt
</code></pre></td></tr><tr><td>Remove files after retrieval</td><td>Delete the remote file after the file is transferred.</td></tr><tr><td>Source files</td><td></td></tr><tr><td>Target Directory</td><td>The directory on the machine on which Hop runs in which you want to place the transferred files</td></tr><tr><td>Create target folder</td><td>Check this option if the destination folder does not exist and should be created.</td></tr><tr><td>Add filenames to result</td><td>If checked the name of the file is added to the result stream.</td></tr></tbody></table>

### Algorithm Negotiation Fail Error

If your `Get a file with SFTP` action returns an error message like the one below, you (or the server you are connecting to) are probably using key types that are considered unsafe in the dependencies used by this action in recent Apache Hop versions.

`com.jcraft.jsch.JSchhAlgoNegoFailException: Algorithm negotiation fail…​`

The better and more secure option is to upgrade your keys to more secure types. However, you can still connect to this SFTP server by adding the options below to the `HOP_OPTIONS` variable in your startup command (in `hop-gui.sh/bat` or `hop-run.sh/bat`, or in your `HOP_OPTIONS` environment variable):

`-Djsch.client_pubkey=ssh-rsa,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256 -Djsch.server_host_key=ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/workflows/actions/sftp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
