I need a script for s3cmd that sends the deletion command for some files in my Amazon S3 bucket. I know there's this method built-in but it's not useuful. Let's see why.
At the moment I have a script that backups my database every midnight and my websites files every Friday and Tuesday (still at midnight).
The script I'm looking for should delete files in order to have on the bucket only: 1 backup per month (let's say, of the 1st day of every month) of both db and files. And leave all the backups (every day for db and tuesday and friday for files, so the "default" behavior) for the last 7 days.
Example, if I'm on june 17th 2012 the situation should be:
1st January 2012: db and files
1st february 2012: db and files
1st march 2912: db and files
1st april 2012: db and files
1st may 2012: db and files
10th june 2012: db
11th june 2012: db
12th june 2012: db and files
13th june 2012: db
14th june 2012: db
15th june 2012: db and files
16th june 2012: db
Then on july 2nd 2012 the bucket should contain:
1st of jan, feb, march, apr, may, june: both db and files
last 7 days: "default" backups untouched (files backup only on tuesday and friday and db every midnight).
The script would automate what I'm doing manually right now (I already have just 1 backup per past month, so I have to delete backups starting from 7 days ago going back to the last 1st-of-the-month backup).
Sorry for the convoluted question, I hope it's clear enough. :D