Automated FTP batch file for ftp scripting

This article inspire me on the 'temp ftp script file' concept.
Batch files - Unattended FTP downloads

This batch file will create a temp ftp script file where it would read the contents and execute the commands.

After the end of the command, it will empty the script file and delete it.

::Location where the temporary script file will be created
CD \
CD Temp
:: Create the temporary script file
> script.ftp ECHO username
>>script.ftp ECHO password
>>script.ftp ECHO prompt off
>>script.ftp ECHO put C:\ftp.txt
>>script.ftp ECHO quit

:: Use the temporary script for unattended FTP
FTP -s:c:\temp\script.ftp
:: Overwrite the temporary file before deleting it
TYPE NUL >script.ftp
DEL script.ftp

Post a Comment