How Do I Batch Delete a Large Number of Objects from a Bucket or Empty a Bucket?
You can batch delete a large number of objects from a bucket or empty a bucket by referring to the procedure below:
Method 1: Using OBS Browser+
OBS Browser+ is a GUI-based desktop application for managing OBS buckets and objects comprehensively. With it, you can easily manage OBS resources on your local PC. On OBS Console, a maximum of 50 objects can be displayed on each page, but OBS Browser+ displays all objects on the same page. By using OBS Browser+, you can select and delete more objects at a time.
- Download, install, and log in to OBS Browser+.
- In the bucket list, click the name of the bucket you want to delete.
- Drag the scroll bar in the object list to load as many objects as possible.
- Select the check box above the object list to select all loaded objects.
Figure 1 Selecting all loaded objects
- Choose More > Delete.
Figure 2 Deleting objects
- In the displayed dialog box, confirm the object information and click Yes.
Method 2: Using Lifecycle Rules
You can use the OBS lifecycle management to periodically empty all objects in a bucket at a time or batch delete objects based on a specified prefix.
- Log in to OBS Console.
- In the navigation pane of OBS Console, choose Object Storage.
- In the bucket list, click the bucket you want to operate to go to the Objects page.
- In the navigation pane, choose Overview.
- In the Basic Configurations area, click Lifecycle Rules. The Lifecycle Rules page is displayed.
- Click Create. A dialog box shown in Figure 3 is displayed.
- Configure a lifecycle rule for emptying a bucket or batch deleting objects with a specified prefix.
Table 1 Lifecycle rule parameters Category
Parameter
Description
Basic information
Status
Select Enable.
Rule Name
User-defined. It identifies a lifecycle rule.
Prefix
Optional.
- If this parameter is configured, objects with the specified prefix will be deleted in a batch.
- If this parameter is not configured, all objects in the bucket will be deleted.
Current version/Historical version
Transition to Infrequent Access After (Days)
Do not select this parameter.
Transition to Archive After (Days)
Do not select this parameter.
Delete Objects After (Days)
Select this parameter and specify a number. It indicates the number of days after the last update when objects are automatically deleted. The minimum value is 1 day. If any of the transition operations is configured, this parameter must be set to a number larger than that specified for any of the transition operations.
NOTE:If versioning is not enabled for the current bucket, specified objects will be automatically deleted after they expire and cannot be recovered.
Delete Fragments After (Days)
This parameter is only available for current version. It indicates the number of days after creation when fragments in the bucket are automatically deleted. The minimum value is 1.
- Current version and Historical version are two concepts for Versioning. If versioning is enabled for a bucket, uploading objects with the same name to the bucket creates different object versions. The object uploaded lastly is called Current Version, and the object uploaded previously is called Historical Version.
- Either the Current Version or Historical Version must be configured, or you can configure both of them. If you want to empty the bucket, configure both of them.
- There may be a delay for deleting objects after the objects expire. The delay generally does not exceed 48 hours. If you change the configurations of an existing lifecycle rule, the rule will take effect again.
- Click OK to complete the configuration.
Buckets and Objects FAQs
- Why Am I Unable to Create a Bucket?
- Why Am I Unable to Upload an Object?
- Why Am I Unable to Download an Object?
- Why Can't I Delete a Bucket?
- Why Can't I Delete an Object?
- Why Can't I Access an Object Through Its URL?
- What Is the Relationship Between Bucket Storage Classes and Object Storage Classes?
- Can I Rename an Object?
- Can I Modify the Region of a Bucket?
- Can I Copy a File Between Buckets?
- Can I Move a File Between Buckets?
- Can I Edit Objects in OBS Online?
- How Do I Obtain the Access Path to an Object?
- Why Can't I Search for Certain Objects in My Bucket?
- How Do I Preview Objects in OBS in a Browser Online?
- What Should I Do If an Error Message Is Displayed When I Use Internet Explorer to Access an Object URL That Contains Chinese Characters?
- With CDN Acceleration Enabled, Why Are the Objects in My OBS Bucket Directly Downloaded When I Access Them?
- Why Is an Error Reported Even If CORS Has Been Configured?
- How Do I Query the Size of a Folder in a Bucket?
- How Do I Batch Delete a Large Number of Objects from a Bucket or Empty a Bucket?
- How Do I Change the Enterprise Project Where My Bucket Belongs?
- How Do I Upload Objects Larger Than 5 GB?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbotmore