tencent cloud

Cloud Object Storage

Move Object Recursive

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

Overview

Recursively move the entire directory tree, including all subfiles and subdirectories, to the target location.
Attention:
Errors may be returned when a COS Agent Bucket receives a move request or is moving an object. If an error occurs before the move operation starts, you will receive a standard error response. If an error occurs during the move 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 move request based on the response body content and handle the result accordingly.

Request

Request Syntax

PUT /<ObjectKey>?recursive HTTP/1.1
Host: <BucketName-APPID>.cos.<Region>.myqcloud.com
x-cos-move-source: <BucketName-APPID>.cos.<Region>.myqcloud.com/<SourceObjectKey>
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.
Authorization: Auth String (For details, see Request Signature).

Request Parameters

Term
Description
Type
Required
recursive
Enables recursive directory move mode. No value assignment is required; it only needs to appear in the URL.
No value
Yes
conflict_resolution_strategy
Conflict resolution policy. For recursive directory move, the optional values are ask and rename, with ask as the default.
In case of a conflict, the system returns HTTP 409 Conflict and the SameNameDirectoryOrFileExists error code.
rename: Automatically renames the last-level directory in case of a conflict.
string
No

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.
<MoveObjectResult>
<ETag>&#34;etag-value&#34;</ETag>
<LastModified>2025-01-15T10:30:00Z</LastModified>
<CRC64>xxx</CRC64>
</MoveObjectResult>
The detailed node descriptions are as follows:
Node Name (Keyword)
Parent Node
Description
Type
MoveObjectResult
None
Stores all information for the Move Object Recursive result.
Container
The content of the Container node SpaceQuota:
Node Name (Keyword)
Parent Node
Description
Type
ETag
MoveObjectResult
The ETag value of the target object (enclosed in double quotes).
string
LastModified
MoveObjectResult
The last modification time of the target object, in RFC 3339 format.
date
CRC64
MoveObjectResult
The CRC64 value of the target object.
integer

Examples

Example One: Simple Case

Request

PUT /myspace/bbb?recursive HTTP/1.1
Host: smhxxx-1250000000.cos.ap-chengdu.myqcloud.com
x-cos-move-source: smhxxx-1250000000.cos.ap-chengdu.myqcloud.com/myspace/aaa
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****

<MoveObjectResult>
<ETag>&#34;d-1780579801973809791&#34;</ETag>
<LastModified>2026-06-04T13:30:01Z</LastModified>
<CRC64>5404623458528365127</CRC64>
</MoveObjectResult>

Example Two: Destination Already Exists During Recursive Move

Request

PUT /myspace/bbb?recursive HTTP/1.1
Host: smhxxx-1250000000.cos.ap-chengdu.myqcloud.com
x-cos-move-source: smhxxx-1250000000.cos.ap-chengdu.myqcloud.com/myspace/ccc
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****

<Error>
<Code>FileAlreadyExists</Code>
<Message>Recursive move operation failed: File already exists.</Message>
<Resource>/smhxxx-1250000000/myspace/bbb</Resource>
</Error>


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan