Delete Daily Backups Except The Latest Three

Daily backups of my blogs are stored in a separate server than the actual web server that hosts all my files. This practice is highly recommended.

Over a period of time, the backups pile up and occupy a lot of disk space. You can delete all the files except the last three files by running the following command.

find . -type f -mtime +2 -print0 | sort -z | xargs -r0 rm

Leave a Reply

Your email address will not be published. Required fields are marked *