sftp status check

Hi All,

I am having shell scripts that make use of ftp to fetch data from one hp-ux box to another. Currently we are migrating these scripts to sftp. Is it a straight forward one? Also, please clarify my following doubts:

1) In ftp we check the success of ftp by verifying the status codes like 200,226 etc. We are not able to identify any similar codes in sftp. How do we verify the status of sftp process , within scripts?

2)Is there any capability that ftp has and will be lost after migration to sftp?

Please shed some light in to this as the requirement is a bit urgent.

Thanks in advance

The -b flag in OpenSSH causes sftp to run in batch mode. While in batch mode, sftp will exit and return an error code of "0" when any get, put, etc. fails. sftp returns a "1" and exits if the connection to the remote fails, or if the user cancels using CTRL-C.

That's all there is as far as I know.

Thats all we found too. We ended up using ls commands and comparing file lists, dates and sizes to make sure the files transferred successfully.
maybe in the next release there will be more usefull output....

I have this same problem.
I am converting some scriped UNIX ftp scripts
to sftp scripts.
For the FTP scripts the FTP return codes are saved to a work file and compared to the directory that mput or mget files before and after the FTP and counts of 150 and 226 return codes are compared and if equal, then all ftp's were treated as successful.
The 200, 150 & 226 ftp return codes indicate a successful FTP for each file.
I can not find any return codes for sftp.
How will I know the files had a successful put file*
or get file* using sftp ?
Would the return code of 0 or 1 from sftp after one or many put's or get's be all that I need to check? Or in other words is the transfer of one or many files all or none?

Looks like Trott & Rolsky's Perl Net::SFTP Module can help with this dilemma.

What I've learned is the standard SFTP shell client is too primitive for rigorous activity, requiring "hacks" to parse debug responses.

Since SFTP technically is not a standard (yet), in some ways it's "not ready for prime time" (ie, critical production applications).