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.


last_day_of_previous_month.s

Download

This script demonstrates some of Robo-FTP's string manipulation and date arithmetic commands. The goal of this script is to create a local folder named for the last day of the previous month.

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

The format for the %date variable is:

MM-DD-YY

This sample script uses the SETMID command to extract the "day" field out of this variable and then uses the DATESUB command to calculate the last day of the previous month.


  1  ; If the current day is 06-20-19, then the following command
  2  ; will set current_day to "20"
  3  SETMID current_day = %date 2 4
  4  SET today = %date
  5  ; If today is 06-20-19 and current_day is 20,
  6  ; then this command will set the value of today
  7  ; to the last day of the previous month
  8  DATESUB today current_day
  9  MAKEDIR today

Browse complete list of scripts