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 ...
- 01-28-2010 #1Just Joined!
- Join Date
- Jan 2010
- Posts
- 1
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
- 01-28-2010 #2Linux Guru
- 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:
You can then take that value and compare it with the original size, which I assume you have saved somewhere, and calculate the % difference.Code:wc -c <filename
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote