I'm new to Linux bash scripting in general and apologies in advance if this question is stupid.
Basically, I have this scenario where I need to obtain the total size of 'png' and 'jpeg' files in the same directory then afterwards compare this total size with a fixed value of (200kb). The problem im having is that I'm not sure how to obtain the total file size in the first place. Any help would be well appreciated..
What I've tried: (find the total file sizes of both jpeg and png files then save it inside variables
jpegsize = $({ find <DIR> -type f -name "*.jpg" -printf "%s+"; echo 0; } | bc)
pngsize = $({ find <DIR> -type f -name "*.png" -printf "%s+"; echo 0; } | bc)
totalsize = $jpegsize + $pngsize
if (($totalsize <= 200000))
then
echo "total image size is small"
else
then
echo "total image size is NOT small"
fi