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.


trigger_file.s

Download

A common strategy for integrating two processes is for one process to create a "trigger file" (sometimes called a "flag file") to indicate to another process that it is OK to proceed with some task.

Consider the case where a process generates a file which Robo-FTP is scheduled to upload at a certain time. It is important that Robo-FTP not try to upload the file until it is ready to send (perhaps the initial process updates the file several times throughout the day). One way the initial process can "tell" Robo-FTP that the file is ready to be uploaded is to create a trigger file (often a 0-byte dummy file with some pre-determined name).

This sample script monitors a local directory for the existence of a trigger file. When that file appears, Robo-FTP uploads the data file (deleting it when upload is complete), deletes the trigger file, then exits.

Trigger files can also be used in the other direction. For example, you could expand this script using the WRITEFILE command (see the Help file for details) to have Robo-FTP generate a trigger file to signal the initial process when the upload is complete.

IMPORTANT: Error handling has been omitted from this sample script for clarity. You should add error handling to any script before deploying.


  1  SET trigger_file = "c:\path\to\trigger_file.txt"
  2  SET data_file = "c:\path\to\data_file.txt"
  3  ; Wait indefinitely for trigger file to appear
  4  GETNEXTFILE trigger_file /timeout=0
  5  FTPLOGON "site_defined_in_site_manager"
  6  SENDFILE data_file /delete 
  7  DELETE trigger_file

Browse complete list of scripts