Bulk Deleting Object Storage Objects

Delete a group of objects in a bucket or folder.

Use the bulk-delete command to delete objects from a bucket based on selection criteria such as a prefix. The CLI submits a separate delete request for each object that matches your the criteria.

Note

If you already know the exact object names to delete and want to delete up to 1,000 objects in a single request, use the batchDeleteObjects API operation.

Using the CLI

Use the oci os object bulk-delete command and required parameters to delete a group of objects from a bucket:

oci os object bulk-delete --bucket-name bucket_name
                

For example:

oci os object bulk-delete --bucket-name MyBucket
                    WARNING: This command will delete 2 objects. Are you sure you wish to continue? [y/N]:
                    Deleted MyRenamedFile.txt [####################################] 100%
                    Deleted logFile.log [####################################] 100%
                    {
                    "delete-failures": {},
                    "deleted-objects": [
                    "MyRenamedFile.txt",
                    "logFile.log"
                    ]
                    }

By default, all objects in the bucket are deleted. Use the Optional Parameters listed in the oci os object bulk-download page to specify what files in bulk to delete.

For a complete list of parameters and values for CLI commands, see the CLI Command Reference.