compare file percent sizes

I need to get a file size and compare it to a previous day file size. If it's larger or smaller by 50 percent I'll replace the new with the old. I know how to get the file sizes but do not know how to calculate if it's 50 percent difference.

Thanks for your help.

Assuming this is in a shell script I would use the bc command and then compare. The fractional values will get truncated but this will not matter for what you need.

ie:

echo "80*.5"|bc
40.0
1 Like

This worked great. Thank you.