I was setting up a cron job where I wanted to delete log files older than 1 day. The command to do this is as below. I am doing this on a AWS Linux EC2 instance.
find /var/log/tomcat8/ -mindepth 1 -mtime +1 -delete
But what I want to achieve is I want to exclude .log
files from getting deleted and want to just delete the files with .gz
extension. Can any body let me know how I achieve that exclusion in find command.