Amazon S3 Tools: Command Line S3 Client Software and S3 Backup

AWS S3 Command Line Clients for Windows, Linux, Mac. Backup to S3, upload, retrieve, query data on Amazon S3.

S3cmd Home   |   S3cmd Download   |   FAQ / KB   

S3cmd: FAQ and Knowledge Base

Main Page > Browse Categories > Tips, Tricks and More > How can I remove a bucket that is not empty?

How can I remove a bucket that is not empty?

You have to empty it first, sorry :-) There are two ways:

  1. The convenient one is available in s3cmd 0.9.9 and newer and is as simple as s3cmd del --recursive s3://bucket-to-delete
  2. The less convenient one available prior to s3cmd 0.9.9 involves creating an empty directory, say /tmp/empty and synchronizing its content (i.e. nothing) to the bucket: s3cmd sync --delete /tmp/empty s3://bucket-to-delete

Once the bucket is empty it can then be removed with s3cmd rb s3://bucket-to-delete

User Comments
Add Comment
Mike -  11 July 2014
Note that it's "--recursive".
admin -  13 July 2014
Thanks, fixed.
Ville -  16 April 2018
Now additionally the "--force" switch is required when deleting a bucket that has content with "--recurse".
Add Comment
No attachments

Did this help you?
Yes No

51% found this information useful

Other Options
Printable Version

Download S3Cmd
 A printable version of the entire FAQ and Knowledge Base is also available.
 For further queries or questions, please contact us.