How to create an RPA Flow using FTP activities
Overview
This tutorial will show you how to create a flow allowing to read the files from FTP server and store it in your local system.
Components
- RPA Management
- RPA Studio
- FTP Server
Requirements
- Before you can start building the flow, you’ll need to install RPA Studio on your machine and set up a connection between the RPA Studio and RPA Management. Check the Infor RPA Studio User Guide for the steps on how to do so.
- Set up a (s)ftp server account
- Store multiple different files in the (s)ftp server folder
- create a file directory to store the files “C:\Data\RPA\RPAFTP\FTPDownloads”
Tutorial
Difficulty: Medium
Estimated completion time: 25 Minutes
- Open RPA Studio on your machine. If you are not signed into the Tenant already you will be asked to sign in before proceeding to RPA flow designer screens.
- On the Home page of RPA Studio click Create New Project and specify the following properties in the popup window:
- Name: FtpActivities
- Project Location: <default>
- Description: Downloading the files from Ftp server and storing in local directory
- Language: VB <selected by default>
- First add the activity FTP list directory which will allow us to list the files in the FTP directory. Let’s configure its properties in a following way:
- for Remote Directory Full Path, which is the path to the directory in the (S)FTP server , let’s create an Argument:
- called RemoteDirectoryFullPath of type string and default value (S)FTP directory e.g. “/local/InforRPA”
- for Retrieved Directories, which the list directories in the (S)FTP server. let’s create an Variable:
- called DirectoryList of type List< string > without any default value
- for Retrieved Files, which the list directories in the (S)FTP server. let’s create an Variable:
- called FileList of type List< string > without any default value .
- for Password, which is the password to the (S)FTP server, provide the password which will be hidden behind the *
- for Protocol, select SFTP or FTP depending which is being used
- for User Name, which is the user of the (S)FTP server , let’s create an Argument:
- called User Name of type string and default value of user name in (S)FTP
- for Host, which is the Host of the (S)FTP server , let’s create an Argument:
- called Host of type string and default value of host in (S)FTP
- for Port, which is the port of the (S)FTP server , let’s create an Argument:
- called Port of type string and default value of port in (S)FTP
- Next we will create a loop which will allow us to download the (S)FTP file one by one. For that we need to add For Each activity and specify the following:
- for each ftpitem
- for Type property as String which is same as a single object type from the FileList variable
- for value property define FileList.
- In the activity on Design Canvas You will see the following text “Foreach ftpitem in FileList” the item signify the single object in this example file within the list of object, here list of FileList
- Next Add Assign to assign the single file path to a variable.Let’s configure its properties in a following way:
- for To, which is the variable to which we will assign the value, let’s create an Variable:
- File of type string
- for Value, which is the value which will be assigned to a variable define the following VB expression: ftpitem.tostring
- Optionally JUST FOR TROUBLESHOOTING RESONS you can add Message Box activity which would allow you to check the File path
- for Input Text define the following VB expression “File(s) present in remote location: ” + File which allows to see the file path
- Message Box Title, Button Selection, Response Code can stay empty
- Now we can add Download FTP File, which will allow us to downaload the files from (S)FTP directory. . Let’s configure its properties in a following way:
- for File Name, which is the name under which the file should be saved, let’s use File
- for File Path, which is the file directory path where it should be saved. let’s create an Argument:
- called LocalFilePath of type String with a default value “C:\Data\RPA\RPAFTP\FTPDownloads”
- for Remote File Full Path which is the path to the file in the (S)FTP server folder, let’s specify the following VB expression RemoteDirectoryFullPath+”/”+File
- for Password, which is the password to the (S)FTP server, provide the password which will be hidden behind the *
- for Protocol, select SFTP or FTP depending which is being used
- for User Name, which is the user of the (S)FTP server , let’s specify User Name argument
- for Host, which is the Host of the (S)FTP server , let’s specify Host arguement
- for Port, which is the port of the (S)FTP server , let’s specify Port argument
- for Output File which is the full path of the file which was downloaded, let’s create the varaibile:
- called DownLoadedFile of type string
- Optionally JUST FOR TROUBLESHOOTING REASONS you can add Message Box activity which would allow you to check if the file was stored.
- for Input Text define the following VB expression “File(s) downloaded into location local: “+DownloadedFile which allows to see the file path
- Message Box Title, Button Selection, Response Code can stay empty
Now, upon running the flow the files are read from the FTP server and will be written in your local system.