tencent cloud

Cloud Object Storage

Delete Object Recursive

Download
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-08-25 15:43:10
Diterjemahkan oleh AI

Overview

Recursively delete the entire directory tree, including all subfiles and subdirectories.
Attention:
Errors may be returned when a COS Agent Bucket receives a delete request or is deleting an object. If an error occurs before the delete operation starts, you will receive a standard error response. If an error occurs during the delete operation, the interface still returns HTTP 200 OK, with the error included in the response body. This means an HTTP 200 OK response can indicate either success or failure. When using this API, you should further determine the success or failure of the delete request based on the response body content and handle the result accordingly.
Deleted data cannot be recovered. Proceed with caution.

Request

Request Syntax

DELETE /<ObjectKey>?recursive HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
Authorization: Auth String

Note:
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com. Here, <BucketName-APPID> is the bucket name with the APPID suffix, for example, smhxxxxxxxxxxxxx-1250000000. <Region> is the available region. For details, see Product Overview.
ObjectKey: The object path.
Authorization: Auth String (For details, see Request Signature).

Request Parameters

Term
Description
Type
Required
recursive
Enables recursive deletion of the entire directory tree. No value assignment is required; it only needs to appear in the URL.
No Value
Yes

Request Body

This API has no request body.

Response

Response Headers

This API only returns common response headers. For details, see Common Response Headers.

Response Body

The request is successful, returning application/xml data.
<DeleteResult>
<Deleted>
<Key>key</Key>
</Deleted>
</DeleteResult>
The detailed node descriptions are as follows:
Node Name (Keyword)
Parent Node
Description
Type
DeleteResult
None
Save all information for the Delete Object Recursive result.
Container
DeleteResult content of container nodes:
Node Name (Keyword)
Parent Node
Description
Type
Deleted
DeleteResult
Entries of successfully deleted objects
Container
Key
Deleted
Path of the successfully deleted object.
string

Examples

Request

DELETE /myspace/bbb?recursive HTTP/1.1
Host: smhxxx-1250000000.cos.ap-chengdu.myqcloud.com
Authorization: q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1566302375;1566309575&q-key-time=1566302375;1566309575&q-header-list=content-length;content-md5;content-type;date;host&q-url-param-list=delete&q-signature=****************************************


Response

HTTP/1.1 200 OK
Content-Type: application/xml
Transfer-Encoding: chunked
Connection: keep-alive
Date: Tue, 20 Aug 2019 11:59:35 GMT
x-cos-request-id: NWQ1YmUwYTdfM2FiMDJhMDlfYzczN18zMGM1****

<DeleteResult>
<Deleted>
<Key>myspace/bbb</Key>
</Deleted>
</DeleteResult>

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan