Updating 2.x scripts

Changes in the script language compared to its 2.x version are minimal, but it is required to change bits and pieces of a script file in order to have it working in the 3.x series:

  • Every variable must start with the character "$". Put $ at the beginning of every variable. See the example below.

    # Variables:
    #
    # 2.x:
    myuser="joe"
    mypass="1234"
    myserver="ftp.host.com"
    myresult=OPENHOST(myserver,myuser,mypass)

    # 3.x
    $myuser="joe"
    $mypass="1234"
    $myserver="ftp.host.com"
    $myresult=OPENHOST($myserver,$myuser,$mypass)

  • Every label must start with the character ":". Put : at the beginning of every label. See the example below.

    # Labels:
    #
    # 2.x
    :mylabel
    GOTO mylabel

    # 3.x
    :mylabel
    GOTO :mylabel

  • The commands ISEQUAL, NOT, ADD and CONCAT are no longer supported. You have to replace them with their corresponding symbol. See the example below:

    # ADD, NOT, ISEQUAL and CONCAT
    #
    # 2.x
    num=ADD(num,3)

    IF(NOT(ISEQUAL(result,"OK")))
            PRINT("operation failed")
    END IF

    IF(ISEQUAL(result,"12451"))
            PRINT("Access error")
    END IF

    mymessage=CONCAT("hello ",name)
    PRINT(mymessage)

    # 3.x
    $num=$num+3

    IF($result!="OK")
            PRINT("operation failed")
    END IF

    IF($result==12451)
            PRINT("Access error")
    END IF

    $mymessage="hello ".$name
    PRINT($mymessage)

  • The command LIST is no longer supported. Use GETLIST and FOREACH instead. See the example below:

    # ScriptFTP 2.x:
    remote_file_listing=LIST()
    PRINT(remote_file_listing)

    # ScriptFTP 3.x:
    GETLIST($list,REMOTE_FILES)
    FOREACH $item IN $list
            PRINT($item)
    END FOREACH
     

  • The command SETSSL has been renamed to SETPROTOCOL. The syntax and parameters are the same.

  • The command QUOTE is no longer used. Use simple quotes (') in the EXEC call:

    # ScriptFTP 2.x:

    # This command produces the external command:
    # copy "my file.zip" C:\destination
    EXEC(CONCAT("copy ",QUOTE,"my file.zip",QUOTE," C:\destination"))

    # ScriptFTP 3.x:

    # This command produces the external command:
    # copy "my file.zip" C:\destination
    EXEC('copy "my file.zip" C:\destination')