# 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.

## auto_update.s

Many customers deploy a large number of copies of Robo-FTP, all running the same script that connects back to a central server to perform file transfers and related tasks.

This can cause a maintenance headache when you decide you want to change something in the script and now have to manually update the script file on each remote machine.

You can avoid this problem by making your scripts self-updating.

This sample script demonstrates a simple technique that allows you to designate a location on the server (in this case a script directory in each user's home directory on the FTP server) where you can place an updated script.

Instead of calling your script directly, have Robo-FTP launch this auto-update script first. The auto-update script logs on to the server and uses the /ifnewer option with the RCVFILE command to download a copy of the script only if the script on the server is newer than the local copy. The auto-update script then uses the CHAIN command to hand over control to your script.

Just store the auto-update script in the same directory as your script.

This sample also demonstrates the use of the -w option on the command line to set the working directory.

You can call the script like this:

 "C:\Program Files\Robo-FTP" -w "C:\path\to\my\script" -s "auto_update.s"


The script assumes you have created a site called "mysite" in the Site Manager.


1  ftplogon "mysite"
2  FTPCD "script"