Download File with FTP

Last Updated: 08/11/2016 Introduced in Verision: 2.0

File Transfer Protocol (FTP) is a secure method to transfer files across a network. Some FTP servers allow an anonymous connection, but many require that you enter the user name and password for the FTP server when connecting. Use a flow to download a file from an FTP 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 > FTP and drag a Download component to the workspace.

Example

In the example, we build a flow that will download a file from an FTP server. 

Begin by navigating to a Designer folder and clicking the Create Flow button.

createFlow

 

Give the flow a name and click OK.

nameFlow

 

To begin building the flow,  add the component that will download the file to the workspace.

In the Flow Designer start-up window,  expand the category Integrations > All Integrations > FTP, and select a Download component. Click Add to add it to the workspace.

 

 flowStarts

 

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.

connectAllSteps

 

 

Next configure the settings for the Download step by selecting it in the workspace and making updates in the Properties panel.

In the FTP > Server > Authentication section, complete the Username and Password fields for the account that will connect to the FTP server.

In the Host field, enter the FTP server Host name.

setFTPConnection

 

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 FTP server that should be downloaded.

In the Remote File Path section, in the Value field, enter the path name on the FTP 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.

inputsAndOutputs

 

This completes the flow, save the flow and run it in the Debugger.

The Events tab lists the flow’s events. The FTP request is sent, and there is a pause as the file is downloaded.

debugRun

 

 A file is found in the FTP location, and is downloaded successfully using the settings in the flow.

NOTE: 

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.

createFile

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.

 

Additional Resources