file size comparision local file and remote file

Hi,

 I have written a script which would FTP a dump file to the FTP server and log the whole activity into a file. to confirm the success of the file copy i grep for "226 file receive OK" and then send out an email saying success. Now i want to make sure the bytes of the local file and remote file are the  same.

i read on the forum that we can do an ls -l on the local and remote files and compare the two..

Upon my research i couldn't find a statement which will extract the bytes from a FTP file and put that into a variable so that i can compare...

Need some help with that.

Hi,
how about using wget (or Your ftp method), to read the file back again, with another name, and then diff them? For example if ASCII/CRLF conversion could mess thing up...

/Lakris

thanks for the reply Lakris...

i did a
result=`ssh user@<hostname> ls -l <filename> | awk '{print $5}'`

this gave me the size in bytes . This fits my requirement.

Great, np,
You could also try

result=$(ssh user@<hostname> stat -c%s filename)

to avoid problems with different formats of ls (LOCALE and such stuff)

/Lakris

PS AND to avoid awk, since I'm just too bad at it :wink:

something new. i will try that...
thanks Lakris...