FTP Commands: Return Values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Where can the return values for ftp commands be found. Do the ftp commands return a special value/character upon successful execution?
 
Erika said:
Where can the return values for ftp commands be found. Do the ftp commands return a special value/character upon successful execution?

Hi

I'm afraid ftp.exe isn't returning anything usual. If you need more control,
you could e.g. use vbscript and a free control that wraps wraps WinInet.dll,
more about this here:

http://groups.google.com/[email protected]
 
The ftp client does not set return codes so much, but ftp server
implementations do reply with various semi-standard messages. 2xx messages
indicate a successful operation, 4xx problems, 5xx failures. So, what you
can do is put ftp commands into somewhat atomic ftp command files. Then
redirect output into log files, and use find to find either significant
results, or significant errors. For instance:
ftp -s:ftpcmds.txt > ftpcmds.log
find /i "250 transfer completed successfully"
if not errorlevel 1 goto success
if errorlevel 1 goto failed

or some variation thereof. All of the above can be neatly packaged into a
single batch file, which accepts a single parm for both the ftp command file
and log file base names. Of course, scripting options abound, and you want
to go with something that you and your co-workers can reasonably support.
I've used batch file programming on NT / Windows 2000 because I assume that
this is generally supportable with documentations, whereas on Linux I've
used perl.

Greg Stigers, MCSA
this space for rent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top