Download File with SFTPLast Updated: 08/11/2016 Introduced in Verision: 2.0
Secure File Transfer Protocol (SFTP) is a secure method to transfer files across a network. Use a flow to download a file from an SFTP server, using the authentication information you specify.
To use a flow to download a file, in the Flow Designer, in the Toolbox panel, expand the category Integration > SFTP and drag a Download component to the workspace.
In the example, we 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 begin building the flow, drag the component that will download the file to the workspace.
In the Flow Designer’s start-up 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 step connects to the FTP server and looks for a file to download, using the settings configure below. Because 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, we want the flow to end.
Next configure the settings for the Download 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 a different port number if needed in the Port field. Also, 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 should be downloaded.
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.
This completes the flow, save the flow and run it in the Debugger.
Note that in Decisions version 3.5 and above, you’ll need to click on Test Flow to access the Debugger.
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.