Created
September 20, 2016 04:15
-
-
Save anonymous/3937ca3aaceb5f83e13968a309a395dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import boto | |
BUCKET_NAME = "bucket-name" | |
DELETE_DATE = "2016-09-15" | |
counter = 0 | |
bucket = boto.connect_s3().get_bucket(BUCKET_NAME) | |
for v in bucket.list_versions(): | |
if (isinstance(v, boto.s3.deletemarker.DeleteMarker) and | |
v.is_latest and | |
DELETE_DATE in v.last_modified): | |
counter += 1 | |
bucket.delete_key(v.name, version_id=v.version_id) | |
print counter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment