checking file size after ftp

I am using ftp to get a file from another server. How can I cross-check the size of a file in korn shell script
john_tAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
biraConnect With a Mentor Commented:
Another simple way to do that :

  a=`wc -c file |awk '{print $1}'`
  echo $a
0
 
biraCommented:

  wc -l file     ( to get the size in lines )
  wc -c file     ( to get the size in bytes )
0
 
biraCommented:

 If you want to find out only the number of lines of a file:

wc -l file |while read x z
do
echo $x
done
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
john_tAuthor Commented:
what if I want only size of the file and store it in a variable?
0
 
biraCommented:
Here is an script example

rsh remoteserver wc -c file|while read x z
                          do
                          init=$x
                          echo $init
                          done

     ftp -n remoteserver   << final
        user username password
        cd /path
        get file
        bye
final
wc -c file|while read x z
           do
           end=$x
           echo $end
           done
    if [ $init -ne  $end ] ;  then
        echo "Size of the original file is different from the file got by ftp."
       else
      echo "Ok..."
    fi
#
0
 
john_tAuthor Commented:
thank you bira
0
All Courses

From novice to tech pro — start learning today.