FTP Functions: ftphandler
The FTP functions enable automation workflows to interact with an FTP (File Transfer Protocol) server. They support operations such as establishing a connection, downloading and uploading files, monitoring directories, creating directories, and closing the connection.
Prerequisites:
- FTP Server Credentials: Ensure you have the server IP, port, username, and password.
Available Commands & Configuration Steps:
- Create Connection (createConnection)
Establish a connection to the FTP server.
- Action: Select Set a Variable Value from the Action dropdown.
- Element Key: Enter a variable name to store the operation status (e.g., FTPConnectionStatus)
- Parameters:
- Select createConnection from the cmd dropdown.
- ServerIP: Enter the FTP server’s IP address (e.g., 123.456.78.9).
- Port: Enter the FTP server port (default is 21).
- UserName: Enter your FTP username (e.g., ftp_user).
- Password: Enter your FTP password (e.g., MyFtpPass123).


Outcome: Returns true if the connection is successful, otherwise false.
- Download (download)
Downloads a file from the FTP server to a local directory.
- Action: Select Set a Variable Value from the Action dropdown.
- Element Key: Enter a variable name to store the operation status (e.g., DownloadStatus).
- Parameters:
- Select download from the cmd dropdown.
- destination: Enter the local path where the file will be saved (e.g., C:Downloadsreport.pdf).
- source: Enter the file path on the FTP server (e.g., /ftp_files/report.pdf).


Outcome: Returns true if the download is successful, otherwise false.
- Upload (upload)
Uploads a file from a local directory to the FTP server.
- Action: Select Set a Variable Value from the Action dropdown.
- Element Key: Enter a variable name to store the operation status (e.g., UploadStatus).
- Parameters:
- Select upload from the Cmd dropdown.
- destination: Enter the destination path on the FTP server (e.g., /ftp_files/uploaded_data.xlsx).
- source: Enter the local file path to be uploaded (e.g., C:Documentsdata.xlsx).


Outcome: Returns true if the upload is successful, otherwise false.
- Watch (watch)
Monitors a directory on the FTP server for files with a specific extension.
- Action: Select Set a Variable Value from the Action dropdown.
- Element Key: Enter a variable name to store the operation status (e.g., WatchedFilePath).
- Parameters:
- Select watch from the Cmd dropdown.
- TargetDirectory: Enter the FTP directory path to monitor (e.g., /ftp_logs/).
- Extension: Enter the file extension to watch for (e.g., .csv).
- Prefix (optional): Enter a filename prefix to filter, e.g., log_ (leave blank if not needed).
- Timeout(optional): Enter the duration (in seconds) to wait for a file(e.g., 30).
- OrderBy (optional): Choose sorting order (asc for ascending, desc for descending).
- dateTime(dd/mm/yyyy hh:mm:ss): <TBD>


Outcome: Returns the path of the detected file if found within the timeout period, otherwise null.
- Create Directory (createDirectory)
Creates a new directory on the FTP server.
- Action: Select Set a Variable Value from the Action dropdown.
- Element Key: Enter a variable name to store the operation status (e.g., DirectoryCreationStatus).
- Parameters:
- DirectoryPath: Enter the path of the directory to be created on the FTP server (e.g., /ftp_new_folder/)


Outcome: Returns true if the directory is successfully created, otherwise false.
- Close Connection (closeConnection)
Terminates the connection to the FTP server.
- Action: Select Set a Variable Value from the Action dropdown.
- Element Key: Enter a variable name to store the disconnection status (e.g., DisconnectionStatus).
- Parameters:
- Cmd: Select closeConnection.


Outcome: Returns true if the connection is successfully closed, otherwise false.