Below is my crontab entry :
* 4 * * * find /path/to/apache/logs -name "apache_*" -type f -mtime +20 -exec rm -f {} \; > /home/user/Deleted-`date +\%Y\%m\%d\%H\%M\%S`.log 2>&1
it is finding the files older than 20 days and removes those without any issue but I'm not able to capture those deleted files' name on the log file.
I have even used the above command in a bash script and tried as below but the same issue.
* 4 * * * /path/to/log_rotate.sh > /home/user/Deleted-`date +\%Y\%m\%d\%H\%M\%S`.log 2>&1
I'm not sure where I'm going wrong. Any suggestion please.Thanks