Script Library

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.


MoveUpload_PreservePath.s

Download

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. This knowledge base article describes the events and built-in variables available: KB#271.

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 destination folder while preserving the relative folder path. This is accomplished by using the /copydirs option on the Robo-FTP MOVE script command.

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 MoveUpload_PreservePath.s (use the Download link above)
  • Edit the script file and change the value of the destination_root variable.
  • 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 MoveUpload_PreservePath.s script file that you saved earlier
  • Click the Apply button

  1  ;; the current working directory is always %event_logonhome
  2  ;; /copydirs copies all path elements under the current working directory
  3  MOVE %event_uploadpath "C:\destination\root\" /copydirs 

Browse complete list of scripts