Last active
June 26, 2020 12:00
-
-
Save Keiku/b4dd802623e55c03f9e20d46c43a4471 to your computer and use it in GitHub Desktop.
Remove S3 files before the specified last update time
This file contains hidden or 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
# Remove S3 files before the specified last update time | |
# Reference: amazon s3 - aws cli s3 bucket remove object with date condition - Stack Overflow https://stackoverflow.com/questions/51375531/aws-cli-s3-bucket-remove-object-with-date-condition | |
aws s3 ls --recursive s3://path/to/ | awk '$1 < "2020-06-25 12:00:00" {print $4}' | xargs -n1 -t -I 'KEY' aws s3 rm s3://path/to/'KEY' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment