This is a (bash) script that renames my import bad file(s) if they exist with a date stamp.
for file in /import/load/bad/*.bad
mv $file $file-`date "+%y%m%d%n"`
If there are no bad files, I get this error message:
"No such file or directory"
It triggers cron to send me an email that is not necessary. I don't want to know that there are no bad files.
I've tried a couple things that haven't worked:
Encase in if
if [ -e /import/load/bad/*.bad ];
do ... done
RESULT: line 1: [: /import/load/bad/verb1.bad: binary operator expected
NOTE: I'm guessing I can't test with a wildcard.
Get last file
CHECK=`ls -rt /import/load/bad/*.bad|tail -1`
RESULT: ls: /import/load/bad/*.bad: No such file or directory