Amazon S3 file cleaner - delete things older than a certain age, matching a pattern, etc.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


The first few hits on google for 's3 delete older than' are "How do I do this?"
with no answers...

So, here's a script that will clean old s3 entries that match a pattern.

Requires boto.

% python --help
Usage: [options]

  -h, --help        show this help message and exit
  --key=KEY         AWS Access Key
  --secret=SECRET   AWS Access Secret Key
  --maxage=SECONDS  Max age a key(file) can have before we want to delete it
  --regex=REGEX     Only consider keys matching this REGEX
  --bucket=BUCKET   Search for keys in a specific bucket
  --delete          Actually do a delete. If not specified, just list the keys
                    found that match.