Help Center> Object Storage Service> FAQs> Buckets and Objects> How Do I Batch Delete a Large Number of Objects from a Bucket or Empty a Bucket?
Updated on 2024-04-01 GMT+08:00

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.

  1. Download, install, and log in to OBS Browser+.
  2. In the bucket list, click the name of the bucket you want to delete.
  3. Drag the scroll bar in the object list to load as many objects as possible.
  4. Select the check box above the object list to select all loaded objects.

    Figure 1 Selecting all loaded objects

  5. Choose More > Delete.

    Figure 2 Deleting objects

  6. 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.

  1. Log in to OBS Console.
  2. In the navigation pane of OBS Console, choose Object Storage.
  3. In the bucket list, click the bucket you want to operate to go to the Objects page.
  4. In the navigation pane, choose Overview.
  5. In the Basic Configurations area, click Lifecycle Rules. The Lifecycle Rules page is displayed.
  6. Click Create. A dialog box shown in Figure 3 is displayed.

    Figure 3 Creating a lifecycle rule

  7. 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.

  8. Click OK to complete the configuration.

Buckets and Objects FAQs

more