How to capture the ftp error code in batch scripts?
You can redirect the output to a log file and when the ftp session is finished the file can be parsed.
@ftp -i -s:"%~f0" > log.txt & GOTO :parse
open ftp.myhost.com
myuser
mypassword
!:--- FTP commands below here ---
lcd "C:\myfolder"
cd /testdir
binary
put "myfile.zip"
disconnect
bye
:parse
for /F "delims=" %%L in (log.txt) Do (
... parse each line
)