I have a question regarding a script in my crontab file. In my crontab, I have the following entries:
10 2 * * * root find /var/lib/amavis/virusmails/ -mtime +31 -exec rm {} \;
15 2 * * * root find /var/lib/amavis/tmp/ -mtime +31 -exec rm -r {} \;
These entries are designed to delete any messages in my email quarantine folder that are older than 31 days. The folder structure is a set of sub directories (a-z, A-Z, and 0-9) under the virusmails folder. The scripts appear to be functioning as desired, but with one annoying side effect. The scripts also attempt to remove the directories as I receive a daily email from the Cron Daemon reporting entries like this: rm: cannot remove `/var/lib/amavis/virusmails/h': Is a directory
How could I change the script to delete only the contents of the directories instead of the directories so that Cron doesn't report this error?
10 2 * * * root find /var/lib/amavis/virusmails/ -mtime +31 -exec rm {} \;
15 2 * * * root find /var/lib/amavis/tmp/ -mtime +31 -exec rm -r {} \;
These entries are designed to delete any messages in my email quarantine folder that are older than 31 days. The folder structure is a set of sub directories (a-z, A-Z, and 0-9) under the virusmails folder. The scripts appear to be functioning as desired, but with one annoying side effect. The scripts also attempt to remove the directories as I receive a daily email from the Cron Daemon reporting entries like this: rm: cannot remove `/var/lib/amavis/virusmails/h': Is a directory
How could I change the script to delete only the contents of the directories instead of the directories so that Cron doesn't report this error?