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.


build_file_name.s

Download

This script demonstrates some of Robo-FTP's string manipulation commands.

Robo-FTP provides several built-in variables set to the current date and time (%date, %time, %datetime).

There may be circumstances where you wish to use the time and date (for example, to build a file name) in a different format than Robo-FTP uses for these built-in variables.

In these cases, you can use Robo-FTP's string manipulation commands to format the time and date any way you like.

The formats for the %date and %time variables are:

%date MM-DD-YY
%time HH.MM.SS

This sample script uses the SETLEFT, SETMID, and SETRIGHT commands to extract the fields out of these variables and then reformats them into a single filename of the form: TestFile_YYYYMMDD.HHMMSS.txt.


  1  SETLEFT month = %date 2
  2  SETMID day = %date 2 4
  3  SETRIGHT year = %date 2
  4  SET filedate = "20" & year & month & day
  5  SETLEFT hours = %time 2
  6  SETMID minutes = %time 2 4
  7  SETRIGHT seconds = %time 2
  8  SET filetime = hours & minutes & seconds
  9  SET filedatetime = filedate & "." & filetime
 10  SET filename = "TestFile_" & filedatetime & ".txt"
 11  DISPLAY filename

Browse complete list of scripts