1752585 Members
4214 Online
108788 Solutions
New Discussion юеВ

Re: file transfer

 
Rushank
Super Advisor

file transfer

Hello,

We do lots of file transfer with rcp using script. Is there anyway I make sure that the file from source is entirely copied to the destination before I issue another command ??

Thanks

5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: file transfer

Hi:

A file is completely copied when the copy process terminates. That does *not* mean that the copy didn't terminate prematurely, perhaps for a network layer error (loss of connection, etc.) or perhaps because the destination filesystem was full.

Perhaps the best way to verify that the file at the source and the file at the destination *are* in fact, exact copies is to 'cksum' the file at both points. If the checksums are equal, then the copy was successful.

See "man cksum".

...JRF...
Dave La Mar
Honored Contributor

Re: file transfer

I picked up this hint from the forum so I could verify ftp transfers.

ftp -v maia << endl>> /somedirpath/ftp.log

It works very well for additional scripts to check for success.

I'm new to unix but maybe this will help.
dl
"I'm not dumb. I just have a command of thoroughly useless information."
Klaus Crusius
Trusted Contributor

Re: file transfer

Hi,

if you check ten exit code of rcp, you should be quite sure, the transfer completed and the files are identical.

rcp from to
|| { echo >2 "rcp failed"; exit 1; }

Klaus
There is a live before death!
Ravi_8
Honored Contributor

Re: file transfer

Hi,
Once the file has been transfered completely the program will terminate by itself. sometimes it may terminate due to network/ link problems,in this case to confirm the complete transfer look at the size of the file on both the machine or u can use 'cksum' command on both machines.
never give up
Wodisch
Honored Contributor

Re: file transfer

Hello Rushank,

you could create a checksum before doing the transfer
on the original station, then re-calculate it on the
destination station, and then compare the results.
"md5sum" comes to mind (Open Source, simple, fast,
proven)...

HTH,
Wodisch