Download File with SFTPLast Updated: 09/16/2018 Introduced in Version: 2.0
Secure File Transfer Protocol (SFTP) is a secure method of transfering 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 Toolbox panel, expand the category Integration > SFTP and drag a Download by BFTP component to the workspace.
In this example, we will build a flow that will download a file from an SFTP server.
Begin by navigating to a Designer folder and clicking the Create Flow button.
Give the flow a name and click OK.
To add the SFTP component, go into the Flow Designer’s Quick Add window, expand the category Integrations > All Integrations > SFTP, and select a Download by SFTP component. Click 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 provides us with 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, we want the flow 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 Host name. 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 for the file on the SFTP server that you want to download.
In the Remote File Path section, in the Value field, enter the path name on the SFTP server where files should be downloaded from.
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 host name) indicated in this field.
In addition, the Output File Name field allows you to change the output name of your 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 clicking on the Debug Flow link.
The Events tab lists the flow’s events. 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.
1. The File that’s been downloaded exists in memory, not in any local file system.
2. To write the file to the file system, use Create File step from Integration > File category in the Toolbox.
3. By default, unless a file has been given a fully qualified path (like C:\MyFiles\[File.Filename]), the file(s) will be written to the Decisions directory (in the default installation C:\Program Files\Decisions\FileStorage\[date downloaded])
4. When writing a file to a network share, make sure that the Services Host Manager has sufficient permissions to write to target relevant network share directory.