sFTP result

Hi all,

batchfile

lcd /home/data/
cd /tmp/source/
get "*.temp.ack"
quit

Result from sftp

1111.temp.ack| 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M2222.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M3333.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M

As I don't know how many records I would be retrieving, counting the number of 100% won't help. Any idea on how to ensure the sftp that I just performed is a successful one? Please help!

There some ways to make sure that the FTP is successfull. one of them is:

count the number of records in the source before FTPing and write it to another file.

then ftp both the files(data and the count files) to the target host.

in the target host you could count the number of records present in the data file and the number present in the count file should match. if it matches then its successful else there is some problem with the FTP.

I hope this helps

may I ask how "count the number of records in the source", can be done?

i have tried "ls -l *.temp.ack | wc -l", but i got

Couldn't stat file ``/tmp/source/wc'', error msg: syserr: No such file or directory, file: wc
Couldn't stat file ``/tmp/source/-l'', error msg: syserr: No such file or directory, file: -l

Please help!

try this:

on the source server

 sed -n '$=' datafile > count_file

FTP both count_file and datafile

then on the target server try this

 
sed '$=' datafile |read TGT_COUNT
cat count_file |read SOURCE_COUNT

if [[ $TGT_COUNT -eq $SOURCE_COUNT ]]; then

echo "FTP SUCCESSFULL"

else
echo "FTP FAILED"
exit 1
fi

I don't believe i would have access to those commands, would it be possible that I try to figure out whether the sftp process was a sucess by looking at the output? Would it be possible to check whether all percentage is 100% after "TOC: HH:MM:SS |"? Please help, thanks!

Output from sftp process

1111.temp.ack| 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M2222.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M3333.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M