Download FTP Server File

Downloads a file from a server via FTP or SFTP.

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

ftpDownload --file(String) --type(FtpType) --host(String) [--useanonymous(Boolean)] [--useprivatekeyauthentication(Boolean)] --sftpusername(String) [--ftpusername(String)] [--password(String)] --remotepath(String) --privatekeyfile(String) (Boolean)=value

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Full File Path file Required Text Full file path containing your directory, file name and extension.

Important:The file path folder structure must be similar to the one on the remote server. Otherwise, the command won't run properly.
Type type Required FtpType Type of protocol to be used: FTP or SFTP.

Both protocols are used to transfer files from one computer to another, but SFTP requires an SSH server connection. Encrypted FTP connections (FTPS) are not supported.
Server Path host Required Text Server connection URI.
Anonymous connection useranonymous Optional Boolean Enable to hide the username, establishing an anonymous connection.
Use private key authentication useprivatekeyauthentication Optional Boolean Enable to enter the path to the private key file.
SFTP username sftpusername Only when Type parameter is SFTP Text Username to access the server via SFTP.
FTP username ftpusername Optional Text Username to access the server via FTP.
Password password Optional Text User password to access the server via SFTP.
Remote Path remotepath Required Text Path on the server where the file is located.
Note:Do to not include the filename on the path.
Private key file privatekeyfile Only when Use private key authentication parameter is True Text Path to the private key file.

Output parameter

Designer mode label Script mode name Accepted variable types Description
Success value Boolean Returns True if the file was successfully downloaded, or False otherwise.

Example

The command downloads a file from a server using the FTP protocol.

defVar --name success --type Boolean
// Downloads a file from a specific root folder in the server by using  FTP. 
ftpDownload --file "local path\\folder1\\folder2\\file" --type "Ftp" --host hostAddress --ftpusername username --password userPassword --remotepath filePath success=value

🛈 Remember: For this example to work properly, it is necessary to use a valid host, with valid username and password for access.