logo If evaluate a condition and branch if true

Return to Introduction     

if number label

if exist filename label


The if script command has two formats. The first format tests the return code of the previous script command and branches to label if the return code is greater than or equal to the number specified in the command. The second format tests if a file exists and branches to label if the specified filename exists in the current directory.




numberis a numeric value. If the reply code from the previous script command is equal to or higher than number, the if command branches to label. Otherwise, processing continues with the next script command
labelis a label somewhere in the script.


filenameis the name of a file in the current directory.






If 400 End

if 550 FileNotFound

If exist readme.txt ReadmeFound


Sample Script:


* Sample script using the "if" command.

* Upload test.txt to a folder that does not exist.

put \folder\test.txt

if 550 exit550

exit 0


exit 550