Created
November 24, 2017 14:54
-
-
Save floehopper/4234ebe26d08ad5e941eaaf7000354c5 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
aws s3api list-objects-v2 --bucket govuk-assets-production --query 'Contents[?length(@.Key) == `24`].[Key]' --output text > orphan-s3-object-keys.txt | |
cat orphan-s3-object-keys.txt | wc -l | |
# ensure the result is 1137 | |
cat orphan-s3-object-keys.txt | xargs -I {} aws s3api delete-object --bucket govuk-assets-production --key {} --output text > deleted-s3-objects.txt | |
aws s3api delete-object --bucket govuk-assets-production --key 9883ea2d-995f-4418-9ca1-abf31b572fa4 --output text >> deleted-s3-objects.txt | |
aws s3api delete-object --bucket govuk-assets-production --key be8a0003-4b25-4047-8a5f-f7ddc3c52716 --output text >> deleted-s3-objects.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment