tcb storage objects cp
Copy an object to a new location, across buckets if needed.
v3.4.0+
PG mode storage commands have been available since @cloudbase/cli@3.4.0.
Usage
tcb storage objects cp <srcKey> <dstKey> -b <bucketId> [options]
Parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
<srcKey> | Yes | Source object name | — |
<dstKey> | Yes | Target object name | — |
-b, --bucket <bucketId> | Yes | Source Bucket ID | — |
--dst-bucket <bucketId> | No | Target Bucket ID | Same as the source bucket |
--copy-metadata <bool> | No | Whether to copy the source metadata | true |
--metadata <json> | No | System metadata JSON merged with the source metadata; COS only recognises cacheControl / mimetype / contentType | — |
--user-metadata <json> | No | User metadata JSON that replaces the target user_metadata entirely | — |
--upsert | No | Allow overwriting an existing object at the target | false |
--json | No | Output the raw SDK result ICopyObjectHttpResult | — |
Validation rules:
- Within the same bucket, a source key equal to the target key without
--upsertfails withINVALID_PARAM. --metadata/--user-metadataonly take effect together with--copy-metadata false; the CLI rejects them otherwise.
Examples
tcb storage objects cp test/hello.txt test/hello-copy.txt -b my-bucket
tcb storage objects cp test/hello.txt backup/hello.txt -b my-bucket --dst-bucket backup-bucket