From man find:
find exits with status 0 if all files are processed successfully, greater than 0 if errors occur. This is deliberately a very broad description, but if the return value is non-zero, you should not rely on the correctness of the results of find.
In the first case an error occurs since the search path is not found. On the other hand the command
find /mydir -name \*.xmlx -mmin +1500
would have returned an exit status of 0. This means that the exit status is not related to the results of the find
command, but to the occurrence of errors that find
might encounter while performing the search. Said that, you have to check something different from the exit status, for example the number of items found or you can simply do a loop over the find results. In this case, no results means no actions taken:
while read file
done < <(find /mydir -name \*xmlx -mmin +1500)
Hope this helps.