Knowledge Base

Enter search queries below or use the tag links to the right to browse the knowledge base by category (Show All Tags).


How to use conditionals (if - then) in Robo-FTP

A common feature of programming languages is to offer a way of evaluating conditional statements that execute a particular set of instructions if a certain condition is met.

Robo-FTP offers this type of functionality by providing numerous commands that either branch to a label or simply flow to the next script command depending on whether a condition is met.

For example, the IFSTRCMP command compares two strings and branches to a label if the two strings match.

 SET string1 = "abc"
 SET sring2 = "def"
 IFSTRCMP string1 string2 GOTO the_strings_match
 ** Robo-FTP will only reach this part of the script
 ** if the two strings don't match. We'll put whatever commands
 ** we want to run when the strings don't match here, then use a 
 ** GOTO to skip ahead to the appropriate place in the script
 GOTO the_rest_of_the_script
 :the_strings_match
 ** The strings match, so we'll run whatever commands we want to
 ** run when the strings match, then continue with the rest of the script
 :the_rest_of_the_script

See the Help file for a complete list of commands and samples of how to use each command.

Article last updated: 2022-01-10

Tags: if-then, if, then, conditional, branch