Harish Singh
Harish Singh

Reputation: 51

Deleting all objects(files & folders) from an Amazon S3 bucket folder

I have an Amazon S3 bucket[example-bucket] and a folder[prod] in it, the use case is to delete all the objects[files and folders] of prod folder.

I tried with this:

aws s3 rm s3://example-bucket/ --recursive --exclude="" --include="prod/.*"

it deletes the files but not the folders from /prod folder, which does not solve my problem. I just want to empty this prod folder.

I will appreciate the help provided to empty the folder.

thank you

Upvotes: 0

Views: 1670

Answers (1)

Charles M
Charles M

Reputation: 55

To empty the prod objects on the prod folder, your command will look like this:

aws s3 rm s3://example-bucket/prod --recursive

Reference: https://docs.aws.amazon.com/AmazonS3/latest/dev/delete-or-empty-bucket.html#empty-bucket

Upvotes: 1

Related Questions