Created
September 20, 2023 07:08
-
-
Save guyzyl/778fede6f85ebf651a9f2285e24e8868 to your computer and use it in GitHub Desktop.
Delete all files in an S3 bucket including file versions
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
import boto3 | |
BUCKET_NAME = "my-bucket" | |
s3 = boto3.resource("s3") | |
bucket = s3.Bucket(BUCKET_NAME) | |
bucket.objects.delete() | |
bucket.object_versions.delete() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment