Emptying a whole R2 bucket is now one click in the dashboard!
Hey everyone, it's Shiichan! Today I've got a small but handy R2 usability update. It's low-key, but I think a lot of you have been waiting for this one!
Cloudflare ChangelogWhat was announced?
Cloudflare's Changelog announced a new capability for the object storage service R2. You can now empty an entire bucket or delete folders directly from the dashboard.
There are two main things here: "Empty Bucket" to clear out a bucket's contents, and "Delete Folders" to remove multiple folders at once.
The story so far
Until now, clearing out everything in a bucket took some extra effort. As the original post puts it:
Previously, removing bucket contents required scripting or configuring lifecycle rules.
When you just want to tidy up a bit, having to write code or set up rules makes it feel like a chore, right?
What changes
From now on it's a single button in the dashboard! You can wipe just the objects inside while keeping the bucket itself and its settings intact. That's super handy when you want to reset a test bucket during development, or clean up folders you no longer need.
Dive Deep
To empty a bucket, you use the "Empty Bucket" section in the bucket's Settings tab. For large buckets the operation runs asynchronously so you can track its progress. And this "empty" action is now a required step before you can delete a bucket.
For deleting folders, the key is R2's flat structure. When you enable the "View prefixes as directories" checkbox, objects get grouped into folders by common prefix. From the Objects tab, you can select one or more of those folders and remove them together with individual object deletions.
And of course, if you'd rather clean up automatically by expiration, you can still use lifecycle rules like before.
Wrap-up
- Emptying an R2 bucket and deleting folders can now be done directly from the dashboard
- Cleanup that used to need scripting or lifecycle rules is now just a button
- The empty operation runs async with progress, and it's now a required step before deletion
- For folder deletion, show prefixes as directories and select/delete them in bulk
This one's perfect for anyone working with R2 who wants to quickly reset a test bucket or clean up unwanted folders!