FileZilla Pro CLI sets an error flag when an error occurs while running a command.
To show if the error flag is set, use the error
command:
error
To clear the error flag, use the clear
command or the error
command with the clear option:
clear
error --clear
To run a command only if the error flag is not set, prefix it with ?
:
?ls directory
To run a command only if the error flag is set, prefix it with @
:
@connect site
To run a command even if the error flag is set and the option cli.error_handling
is set as 1
– skip if error flag is set, prefix it with !:
set cli.error_handling skip
!cd directory
Prefix a command with ^
and the error flag is not set in case of error:
^mkdir directory
To clear the error flag before running the command, prefix it with *
:
*mkd directory
Example
# Set error handling to exit in case of error
set cli.error_handling exit
# Connect to a remote server. If it fails, the script exits.
connect ftps://user:password@example.com
# Set error handling to continue in case of error
set cli.error_handling run
# Creates a directory. If it fails, the error flag is not set
^mkdir directory
# Change current directory. If it fails, the error flag is set
cd directory
# Quits if the previous command failed
@quit
# Upload a file. Only runs if the error flag is not set
?put file.txt
Related Topic: