Download File with SFTP
  • 28 Jul 2022
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Download File with SFTP

  • Dark
    Light

Article summary

Overview

Secure File Transfer Protocol (SFTP) is a secure method of transferring files across a network. You can use a Flow to download a file from an SFTP server with the proper authentication information.
To use a flow to download a file, go to the Flow Designer. In the Steps panel, expand the category Integration > SFTP and drag a Download by SFTP step to the workspace.


Example

In this example, build a flow that will download a file from an SFTP server.
Begin by navigating to a Designer Folder and selecting the CREATE FLOW button. Name the Flow and select Create.
2017-12-27_152616-1024x611.png


To add the SFTP step, in the Steps panel, expand the category Integrations > All Integrations > SFTP, and select a Download by SFTP step. Select 'Add' to add it to the workspace.

The Download by SFTP step connects to the FTP server and looks for a file to download, using the settings configured below. In the situation where there may not be a file to download, the step has two outcomes, found and not found. Connect both of these paths to the End step because, whether there is a file to download or not, the Flow needs to end.

Next, configure the settings for the Download by SFTP step by selecting it in the workspace and making updates in the Properties panel.
In the SFTP > Server > Authentication section, complete the Username and Password fields for the account that will connect to the SFTP server.
In the Host field, enter the SFTP Server Hostname. Enter the correct port number in the Port field and select whether the connection uses SSL.


In the section Inputs > Output FileName, select Constant from the Mapping Type drop-down list.
In the Value field, enter the name of the file on the SFTP server to download.
In the Remote File Path section, in the Value field, enter the pathname on the SFTP server where files should be downloaded.
In the section Outputs > Found > File, in the Name field, enter a name for the file once it is downloaded.

The Remote File Path should have the full file path, after the hostname, indicated in this field.

In addition, the Output File Name field allows designers to change the output name of the file once downloaded. If a user wishes to not rename this file in the flow, then the current setup is fine.


Save the Flow and run it in the Debugger by selecting the Debug in the top action panel.
The SFTP request is sent, and there is a pause as the file is downloaded. A file is found in the SFTP location and is downloaded successfully using the settings in the flow.

The File that’s been downloaded exists in memory, not in any local file system. Learn how to write the file to the file system.


Was this article helpful?