On my FTP server, I look for files delivered in the past day and remove in-place header & trailer records.
find . -type f -name "CDC*" -ctime -1 -exec sed -i'' -e '1d' -e '$d' '{}' \;
This works well.
I want to automate this in a script. But how can I send myself an email notification is no files are found? I am thinking of doing something like:
find . -type f -name "CDC*" -ctime -1 -exec sed -i'' -e '1d' -e '$d' '{}' \;
EXIT=`echo $?`
case $EXIT in
0) ...do stuff...
*) mail....exit
esac;;
There has to a better way, right?