0

I am taking and uploading mongodb backup on s3 every two hours with cron.

17 */2 * * *

Now I want to keep all files of last 7 days, and want to delete all files from s3 after 7 days but want to keep one backup for 1 day.

I am using S3cmd.

How can I do that?

PradyJord
  • 2,136
  • 12
  • 19
Alpesh
  • 107
  • 8
  • please elaborate on keeping 1 day backup; according to what I have understood: `find ./ -mtime +1 -exec rm -rf {} \;` – PradyJord Jun 03 '14 at 08:13
  • Thanks for your reply. After reading few other articles I fixed it myself. I used **s3cmd ls s3://$S3_BUCKET_NAME |awk "/$WEEK_AGO-*/"** to list all files and then delete them one by one. – Alpesh Jun 03 '14 at 10:35

0 Answers0