Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.
This sample script was written for use with Robo-FTP Server v3.3.3. The steps may vary slightly for newer or older versions. This sample script is NOT for use with the Robo-FTP client.
Robo-FTP Server provides a powerful event-driven automation interface which enables you to launch Robo-FTP scripts in response to events such as a user logging on, uploading a file, etc. This interface is called Server Event Scripts.
Several built-in variables are automatically populated whenever a Server Event Script is triggered. These variables contain information relevant to the event. For example, when a user uploads a file, variables are populated with information like the filename, the path to the file, etc. The following page from the Help file describes the events and built-in variables available: Programming Server Event Scripts.
This is a Robo-FTP Server Event Script designed to be used with the Upload Complete event.
The purpose of this script is to move uploaded files to a remote FTP server and then archive the file.
To configure Robo-FTP Server to launch the event script at the appropriate time, follow these steps:
- Download this sample script and save it as
forward_uploaded_files.s(use the Download link above)
- Create a Managed Site named "My Remote Server" with the login information for the remote FTP server in the Server Event Script Configurator tool
- Edit the downloaded script file and change the first line to specify the directory where you want to store files once they have been forwarded.
- Launch Robo-FTP Server Console
- Select Automation in the navigation bar on the left
- Select "Enable for all" under Server Event Scripts on the right
- Select "Upload Complete" from the Server Event drop-down list
- In the Event Script File Name box enter the full path to the
forward_uploaded_files.sscript file that you saved earlier
- Click the Apply button
1 SET my_archive_dir = "c:\my\archive\dir" 2 ARCHIVEDIR my_archive_dir 3 FTPLOGON "My Remote Server" 4 IFERROR GOTO failure 5 SENDFILE %event_uploadpath /archive 6 IFERROR GOTO failure 7 GOTO done 8 :failure 9 DISPLAY 10 ;; Add scripting here to send notification when there is an error 11 ;; or perform other tasks in the event of an error 12 :done 13 EXIT