Command to find and delete files older than certain days
find /path/to/files -type f -mtime +10 -delete
You can add a filter to find certain files matching a pattern e.g.
find /path/to/files -type f -mtime +10 -name "*.log" -delete
The command can be added to cron job for it to run periodically. E.g. To delete files older than 7 days everyday at 4:00 AM.
00 4 * * * find /path/to/files/* -mtime +7 -exec rm {} \;