Find and delete files older than 1 week (example)

find /home/users/backup_MyDB -type f -mtime +7 -exec rm {} +

Although generally it is wise to see what you are deleting before you delete (at least when testing you script) for this just do:

find /home/users/backup_MyDB -type f -mtime +7

Leave a Reply