Last active
October 14, 2016 18:37
-
-
Save leventyalcin/7ac3a8a89d9e65a18eb3 to your computer and use it in GitHub Desktop.
Recover deleted files on Amazon S3
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
aws --output=text --profile=PROFILE s3api list-object-versions --bucket BUCKET_NAME --region=REGION --prefix=DIRNAME \ | |
| grep -e "DELETEMARKERS\tTrue" \ | |
| while read LINE \ | |
do \ | |
KEY=`echo $LINE | awk '{print $3}'` VERSION=`echo $LINE | awk '{print $NF}'` \ | |
aws --profile=PROFILE s3api delete-object --bucket BUCKET_NAME --key $KEY --version-id $VERSION --region=REGION \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment