I have a simple script to check a file of today's date. In the below example, the else condition is ignored if the file is not found. Why so?
if filedir=$(find . -type f -name "*.sql.gz" -mtime -1 -printf "%f\n"); then
echo $filedir
else
echo "oops"
fi