The professional tool to automate FTP, SFTP, FTPS and Batch FTP

ScriptFTP does not provide any commands for copying, deleting or moving local files because these commands are already included in the operating system. The way to access them is using the EXEC command. For example:

# Delete all temporary files from
# LocalWebFolder before synchronizing
EXEC("del /F /Q C:\LocalWebFolder\*.tmp")

In the above script, we use the EXEC command to call the external program “del”. The result is the same as if you had opened a command line window and typed “del /Q C:\LocalWebFolder”. For further information about using the Windows command line programs type “help” at the command line.

Note that some external commands such as copy, rename and del need the file name enclosed in double quotes when it contains spaces. For example, if we need to copy a file named Report 2008.xls to a directory whose path is C:\Reports:


The first attempt returned an error because copy were trying to find the files Report and 2008.xls and they do not exist. In the second attempt we enclosed the file name between quotes and it worked. Copy understood that the file name was the text string between the double quotes. Translating this operating system command to ScriptFTP just requieres pasting it as is inside EXEC(). But a problem arise, ScrpitFTP also uses double quotes to delimit text strings:

# Do not use this. Syntax error.
EXEC("copy "Report 2008.xls" C:\Reports")

This produces a syntax error, too many double quotes. How can ScriptFTP know where the string starts and ends? Use single quotes instead. ScriptFTP accepts both:

# Correct
EXEC('copy "Report 2008.xls" C:\Reports')
# Wrong. Copy will show an error because
# it tries to copy the files "Report" and "2008.xls"
# which do not exist.
EXEC("copy Report 2008.xls C:\Reports")
# Wrong. ScriptFTP will show a syntax error
# because of the EXEC command syntax, the quotes use
# is incorrect.
EXEC("copy "Report 2008.xls" C:\Reports")