Download File with FTP
- Updated on 09 May 2013
- 3 minutes to read
File Transfer Protocol (FTP) is a secure method for transferring 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. You can use a flow to download a file from an FTP server, using the authentication information you specify.
To create a flow that can be used to download a file first go the Flow Designer. In the Toolbox panel, expand the category Integration > FTP and drag a Download component to the workspace.
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.
Give the flow a name and click Create .
In order to build this flow we have to add the component that will download the file to the workspace.
In the Flow Designer Quick Add window, expand the category Integrations > All Integrations > FTP , and select a Download 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 configured below. In some cases there may not be a file to download. To handle this situation the step has two outcomes; found and not found . Connect both of these paths to the End step to ensure our flow ends regardless if there is a file to download.
Next configure the settings for the Download step by selecting it in the workspace and configuring it 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.
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.
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.
This completes the flow. Save it and run it in the Debugger. The FTP request is sent, and there is a pause as the file is downloaded.
A file is found in the FTP 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 Steps panel.
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 permissions to write to a target relevant network shared directory.