Created
April 15, 2025 15:04
-
-
Save jonmchan/6be1f8f3e1b4ae3aa7f1bf921295ee6b to your computer and use it in GitHub Desktop.
one-liner to delete all files within an S3 bucket
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
export AWS_DEFAULT_REGION= | |
export AWS_ACCESS_KEY_ID= | |
export AWS_SECRET_ACCESS_KEY= | |
aws --endpoint=https://<YOUR_ENDPOINT> s3 ls s3://<YOUR_BUCKET>/|awk '{print $4 }' | xargs -I {} -d\\n -n1 aws --endpoint=https://<YOUR_ENDPOINT> s3 rm s3://<YOUR_BUCKEt>/{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment