FTP batch processing and return code

My application needs to upload files on a remote server. I think FTP is the best way to do that and I'm writing the FTP batch (running on Windows 2000).

The basic scripting is ok (connexion and put command) but I cannot figure out how to know whether the command has been completed or not.

In fact my application need to upload a specific file to the remote host and DELETE it locally if the FTP was done correctly. If FTP failed, the local file should NOT be deleted and it will be uploaded in a fruther attempt.

What could I use in order to get the result (return code) of my FTP command (I'm using FTP -s:script.ftp)?
Thank you in advance for your help.
J. Zimmerli
Who is Participating?
I think you can redirect the output from the console to a file and after that check if in the content of the file a certain string presents.
Try adding this to the end of the command..

>>c:\test.txt (this would place a log file in c: named test.txt)  It would look like this...

FTP -s:script.ftp >> c:\test.txt
joel011197Author Commented:
Both suggestions were ok but a little bit to complicated to implement. Furthermore, I need to get different error level if 1) login failed or 2) file upload failed.
So I installed easyphp on my box and the different ftp functions are exactely doing what I need.
Thank you for your help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.