Copy data
Updated at:2025-11-03
Overview
Data copying involves duplicating specific data (objects) from one storage location (bucket) to another without altering the original content. For files in the Archive storage class, they must first be restored before copying. Additionally, the Archive class does not allow metadata updates. Data copying can be implemented using the CopyObject API provided by BOS.
Application scenarios:
- Object backup: To back up a specific object, use the CopyObject API to duplicate the object into another bucket.
- Renaming an object: To rename an object, first use the CopyObject API to copy the original object with a new name, then delete the source object.
- Modifying an object’s metadata: If you need to update only the metadata of an object, you can use the CopyObject API. Copy the object back to the same location (i.e., source and destination are the same) while updating the metadata. In this case, BOS will only modify the metadata of the object.
Operation types
BOS supports copying objects using both APIs and SDKs, with the specific methods as follows:
- Copy an object using the CopyObject API
-
Copying an object using SDK
- Java SDK
- [Python SDK](BOS/SDK/Python-SDK/File management/Copy Object.md)
- PHP SDK
- C# SDK
- Android SDK
Note
- You must have read permissions for the source object and read-write permissions for the destination bucket; otherwise, the operation will not succeed.
- Objects created through append uploads (AppendObjects) cannot be copied.
- For files smaller than 5 GB, use simple copy (BOS API: CopyObject).
- For files larger than 5 GB, use multipart copy (BOS API: UploadPartCopy).
