Script

FTP

The professional tool to automate FTP, SFTP, FTPS

and schedule FTP batch jobs

Syntax:

EXEC(command)

  • command: external program or command including any parameters.

Remarks:

Some external commands require parameters to be enclosed in double quotes. If you merely fill in the double quotes ScriptFTP will display a syntax error, for example:

# This will produce a syntax error:
EXEC("copy "C:\path with spaces\Report 2008.txt" C:\saved")

In order to resolve this problem you will have to use ‘ instead of “. For example:

EXEC('copy "C:\path with spaces\Report 2008.txt" C:\saved\notes.sav')

Return value:

This command will return the called program’s exit code.

Examples:

# Delete all doc files in the current local dir
EXEC("del *.doc")
 
# Call an external batch file
EXEC("mybatch.bat")
 
$result=EXEC("del *.mf")
IF($result!=0)
    IF($result==1)
        print("No *.mf files found. Errorcode: ".$result)
    ELSE
       print("Del failed. Errorcode: ".$result)
       exit(1969)
    END IF
ELSE
    print("deleting files was successful")
END IF