You can copy an object from a bucket (source bucket) to another bucket (destination bucket) within the same region.

Use the following code to copy an object:

OSSCopyObjectRequest * copy = [OSSCopyObjectRequest new];
copy.bucketName = @<bucketName>;
copy.objectKey = @"<objectKey>";
copy.sourceCopyFrom = [NSString stringWithFormat:@"/%@/%@", @"<bucketName>, @"<objectKey_copyFrom>"];

OSSTask * task = [client copyObject:copy];

[task continueWithBlock:^id(OSSTask *task) {
	if (! task.error) {
        // ...
    }
    return nil;s
}];
Notice
  • The source and destination objects must belong to the same region.
  • During the copy operation, if the source and destination objects have the same IP address, you can modify the Object Meta of the existing objects.
  • You cannot use CopyObject to copy an object whose size exceeds 1 GB. To copy an object larger than 1 GB, use multipart upload.