IFFILE        Conditional branch to label if file exists

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands >

IFFILE        Conditional branch to label if file exists

Syntax:

IFFILE

[ file name ]  GOTO  [ label ]

Arguments:

[ file name ]

Variable or string defining a file or path name; if no path is defined Robo-FTPs working folder is used.

 

[ label ]

A valid label within the current script file which is branched to if the specified file exists.

Options:

none

 

 

 

This script command checks for the existence of the specified local file and branches to [ label ] if the file exists. Robo-FTP attempts to open the local file to ascertain if it exists or not, so make sure that you have the proper privileges to access the file. Wildcard characters are not permitted in the [ file name ] argument.

 

For example:

 

IFFILE "c:\Program Files\Robo-FTP X.X\thisfile" GOTO found it

DASHBOARDMSG "File not found."

GOTO done

 

:found_it

DASHBOARDMSG "File was found, uploading now ..."

SENDFILE "c:\Program Files\Robo-FTP X.X\thisfile"

 

:done

FTPLOGOFF

STOP

 

 

The IFFILE command is only for use with local files. A combination of the FTPCD, GETSITEFILE and IFERROR commands is required to branch script execution based on the existence of a specific remote file, for example:

 

FTPCD "/root/subfolder"

GETSITEFILE "thisfile"

IFERROR= $ERROR_SUCCESS GOTO found_it

DASHBOARDMSG "File not found."

GOTO done

 

:found_it

DASHBOARDMSG "File was found, downloading now ..."

RCVFILE "thisfile"

 

:done

FTPLOGOFF

STOP

 

 

Related command(s): IFNFILE, DELETE, WRITEFILE, READFILE, WORKINGDIR, BROWSE