Find the answer to your Linux question:
Results 1 to 2 of 2
I am new at scripting and need help developing a script that will look at a diff file size I've created from the original file and compare the size to ...
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    1

    Exclamation File Size Comparison Script HELP PLEASE!!!

    I am new at scripting and need help developing a script that will look at a diff file size I've created from the original file and compare the size to the orignal and send a return code of 1 to the /etc/notify if the file is less than 6-% of its original size.

    Basically:

    If diff_file < 60% of original_file
    send return code 1 to start paging.
    else
    send return code 0 to stop paging

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    You can get the size of a file in bytes with this shell command:
    Code:
    wc -c <filename
    You can then take that value and compare it with the original size, which I assume you have saved somewhere, and calculate the % difference.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...