Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Amazon S3 file cleaner - delete things older than a certain age, matching a pattern, etc.
Branch: master
Failed to load latest commit information.
LICENSE - Add a license to explicitly say bsd license.
README - Add help Add --bucket flag, oops.


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.

Something went wrong with that request. Please try again.