Issue with Error handling,not able to continue the script further

Hi,

I am trying to write a script to cleanup files in a log directory ..

cd log
find Datk*[0-9]* -mtime +7 -exec rm -f {} \; 2> /dev/null

Have used the above to clean up files in log directory more then 7 days older.
The file can be something like ( auto-generate by some processes and other scripts )
Datk.010927346
Datk.85132523

If the file is not found in the directory then the code fails on find and errors out.

I dont want to code to error out, instead i want it to continue with further statements in the script.

What should I do to make it work?

Many Thanks

Considering that this script prints:

#!/bin/sh

false
false
false
false
false
echo asdf

...I don't think your script is merely "erroring out", I think you have a syntax error, or the logic causes it to exit. Could you post your entire script? What shell are you using?

cd log
find . -name "Datk.[0-9]*" -type f -mtime +7 -exec rm -f {} \; 2> /dev/null