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.


Rcvfile_and_add_extension.s

Download

It is often necessary to rename files while downloading due to differences between the remote and local file systems.

One example of this is the use of file name extensions. You may be downloading files from a server running on an operating system that does not use file name extensions. However, you are downloading the files to a Windows machine where it is easier to work with files that are named with extensions.

This script uses Robo-FTP's string manipulation commands to create a variable that holds the modified file name.

It then demonstrates how to use the /as option to automatically rename the file while downloading.

This example uses GETSITEFILE to simply process the first file it finds on the remote server. If you need to download all files in a directory then you would need to set up a loop that iterates through all files in the directory. See the Help file entry for GETSITEFILE for examples that show how to set up such a loop.


  1  LOG "TestScriptlog.log"
  2  TRACELOG "TestTracelog.log"
  3  
  4  FTPLOGON 
  5  GETSITEFILE "*"
  6  SET new_name = %sitefile & ".txt"
  7  DISPLAY new_name
  8  RCVFILE %sitefile /as new_name
  9  FTPLOGOFF

Browse complete list of scripts