Using cron to delete files older than X minutes/ days

If you want to empty files in /tmp folder older than X minutes:

find /tmp -mmin +30 -type f -name "*.*" -exec rm -f {} ;

+30: 30 minutes; “*.*”: if you want to delete all files (please specify name as you want)

If you want to empty files in /tmp folder older than X days:

find /tmp -mtime +1 -type f -name "*.*" -exec rm -f {} ;

+1: 1 days (24 hours); “*.*”: if you want to delete all files