Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

checking file size after ftp

Posted on 2001-08-15
6
Medium Priority
?
254 Views
Last Modified: 2010-04-21
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
0
Comment
Question by:john_t
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 6

Expert Comment

by:bira
ID: 6389702

  wc -l file     ( to get the size in lines )
  wc -c file     ( to get the size in bytes )
0
 
LVL 6

Expert Comment

by:bira
ID: 6389717

 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
 

Author Comment

by:john_t
ID: 6389819
what if I want only size of the file and store it in a variable?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Expert Comment

by:bira
ID: 6389835
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
 
LVL 6

Accepted Solution

by:
bira earned 260 total points
ID: 6389857
Another simple way to do that :

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

Author Comment

by:john_t
ID: 6390291
thank you bira
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question