All Products
Search
Document Center

Object Storage Service:cp (Copy object)

Last Updated:Mar 19, 2026

Copy objects within a bucket or between buckets in the same region using the ossutil cp command. The object content remains unchanged.

Prerequisites

Before you begin, make sure you have the following permissions on the source and destination buckets:

  • oss:GetObject

  • oss:ListObjects

  • oss:PutObject

For details, see Grant custom access policies to RAM users.

Usage notes

  • Only objects can be copied. Unmerged parts from an incomplete multipart upload cannot be copied.

  • By default, both object metadata and tags are copied. Use --copy-props to change this behavior.

  • Cross-account and cross-region copy operations are not supported. To migrate objects across accounts or regions, use ossimport or Data Online Migration.

  • The -u / --update option sends at least one HEAD request per object, regardless of whether the destination object exists. In scenarios with infrequent data changes, this generates unnecessary requests that may affect performance and incur additional request fees. Evaluate your use case carefully before using this option.

Command format

ossutil cp oss://src_bucket[/src_prefix] oss://dest_bucket[/dest_prefix] [flags]

Path parameters

ParameterTypeDescription
src_bucketstringThe name of the source bucket.
src_prefixstringA directory or prefix in the source bucket.
dest_bucketstringThe name of the destination bucket.
dest_prefixstringA directory or prefix in the destination bucket.

Destination object naming rules

The destination object name depends on dest_prefix and whether you are copying a single object or in batch:

Scenariodest_prefixDestination object name
Single object copyEmptyRelative path of the source object
Single object copyEnds with /dest_prefix + relative path of the source object
Single object copyDoes not end with /Identical to dest_prefix
Batch copyEnds with /dest_prefix + relative path of the source object
Batch copyDoes not end with /dest_prefix + / + relative path of the source object

Options

For a full list of global options, see Command-line options.

Copy behavior

OptionTypeDescription
-r, --recursive/Apply the command recursively to all matching objects in the bucket. Without this option, the command applies only to the object specified by the path.
-f, --force/Skip the confirmation prompt.
--copy-propsstringControl how object attributes and tags are copied. Valid values: default (copy both attributes and tags), metadata (copy attributes only), none (copy data only, skip attributes and tags). Default: default. Attributes include Content-Type, Content-Language, Content-Encoding, Content-Disposition, Cache-Control, Expires, and user metadata.
--aclstringSet the access control list (ACL) of the destination object. Valid values: private, public-read, public-read-write, Default (inherit from bucket).
--storage-classstringSet the storage class of the destination object. Valid values: Standard, IA (Infrequent Access), Archive, ColdArchive (Cold Archive), DeepColdArchive (Deep Cold Archive).
--metadatastringsSet user metadata on the destination object. Use key=value format.
--metadata-directivestringControl how to set the destination object's metadata. Valid values: COPY, REPLACE.
--taggingstringSet tags on the destination object. Use key=value format.
--tagging-directivestringControl how to set the destination object's tags. Valid values: COPY, REPLACE.
--version-idstringThe version ID of the source object to copy.
--request-payerstringThe payment method for the request. For pay-by-requester buckets, set this to requester.

Incremental copy

OptionTypeDescription
-u, --update/Skip destination objects that already exist and were modified more recently than the corresponding source objects. If the destination object has the same modification time as the source object, the destination object is updated.
--checksum/Copy only source objects whose size or CRC64 checksum (if it exists) differs from the destination object. Valid for object-to-object copy only. The check sequence is: (1) compare sizes; (2) if sizes match, compare CRC64 checksums; (3) copy only if checksums differ.
--size-only/Copy only source objects whose size differs from the destination object.
--ignore-existing/Skip destination objects that already exist. Only objects not present at the destination are transferred.

Filtering

OptionTypeDescription
--includestringArrayRules to include objects by path or filename pattern.
--include-fromstringArrayRead inclusion rules from a file.
--excludestringArrayRules to exclude objects by path or filename pattern.
--exclude-fromstringArrayRead exclusion rules from a file.
--filterstringArrayRules to filter objects by path or filename.
--filter-fromstringArrayRead filtering rules from a file.
--min-ageDurationCopy only objects modified before the specified time interval. Default unit: seconds. Example: 1h copies only objects modified 1 hour ago or earlier.
--max-ageDurationCopy only objects modified within the specified time interval. Default unit: seconds. Example: 1h copies only objects modified within the last hour.
--min-mtimeTimeCopy only objects modified after the specified UTC time. Format: 2006-01-02T15:04:05.
--max-mtimeTimeCopy only objects modified before the specified UTC time. Format: 2006-01-02T15:04:05.
--min-sizeSizeSuffixThe minimum size of an object to transfer. Default unit: bytes. Supported suffixes: B, K, M, G, T, P. 1 K (KiB) = 1024 B.
--max-sizeSizeSuffixThe maximum size of an object to transfer. Default unit: bytes. Supported suffixes: B, K, M, G, T, P. 1 K (KiB) = 1024 B.
--start-afterstringCopy only objects that are alphabetically after the specified value.
--end-withstringCopy only objects that are alphabetically before or equal to the specified value.
--metadata-includestringArrayRules to include object metadata.
--metadata-excludestringArrayRules to exclude object metadata.
--metadata-filterstringArrayRules to filter object metadata.
--metadata-filter-fromstringArrayRead object metadata filtering rules from a file.
-d, --dirsstringProcess objects and subdirectories in the current directory without recursing into subdirectories.
--list-objects/Use the ListObjects operation to list objects.
--encoding-typestringEncoding type for input object names or filenames. Valid value: url.

Input from file

OptionTypeDescription
--files-fromstringArrayRead the list of source objects from a file. Empty lines and commented lines are ignored.
--files-from-rawstringArrayRead the list of source objects from a file, including empty and commented lines.

Performance

OptionTypeDescription
-j, --jobintNumber of concurrent tasks. Default: 3. Takes effect only when used with -f, --update, --size-only, or --ignore-existing.
--parallelintNumber of concurrent tasks for internal operations within a single object.
--checkersintNumber of checkers to run in parallel. Default: 16.
--bandwidth-limitSizeSuffixLimit network bandwidth. Minimum: 1024 B/s. Default unit: B/s. Supported units: B, K, M, G. Example: 50M limits bandwidth to 50 MB/s.
--bigfile-thresholdSizeSuffixSize threshold for enabling multipart copy. Default: 104857600 (100 MiB).
--part-sizeSizeSuffixPart size for multipart copy. ossutil automatically calculates a suitable part size by default. Valid range: 100 KiB–5 GiB.
--page-sizeintMaximum number of objects listed per page during batch copy. Default: 1000. Valid range: 1–1000.

HTTP metadata

OptionTypeDescription
--cache-controlstringCaching behavior when the object is downloaded.
--content-dispositionstringHow the object is displayed.
--content-encodingstringEncoding format of the object.
--content-typestringContent type of the object.
--expiresstringAbsolute expiration time of the cached content.

Checkpoint and output

OptionTypeDescription
--checkpoint-dirstringDirectory for checkpoint files used in resumable operations. Default: .ossutil_checkpoint/.
--output-dirstringDirectory for error report files generated during batch processing. Default: ossutil_output.
--no-progress/Suppress the progress bar.
--no-error-report/Suppress error report file generation during batch processing.

Examples

Copy a single object

Copy examplefile.txt to a folder in the same bucket:

ossutil cp oss://examplebucket1/examplefile.txt oss://examplebucket1/desfolder/

Rename an object

Copy an object to a new key in the same bucket:

ossutil cp oss://examplebucket1/examplefile.txt oss://examplebucket1/example.txt
cp leaves the source object intact. Delete the source object manually after renaming if needed.

Copy incremental objects

Use --update to skip destination objects that already exist and are newer than the source:

ossutil cp oss://examplebucket1/srcfolder1/ oss://examplebucket1/desfolder/ -r --update

Copy objects between buckets after same-region replication

Use --checksum for strict content consistency verification—for example, to retry a failed batch copy while skipping already-copied objects:

ossutil cp oss://examplebucket1/srcfolder1/ oss://examplebucket1/desfolder/ -r --checksum

The command compares sizes first. If sizes match, it compares CRC64 checksums and copies only objects where the checksums differ.

Use --ignore-existing to transfer only objects not yet present at the destination:

ossutil cp oss://examplebucket1/srcfolder1/ oss://examplebucket1/desfolder/ -r --ignore-existing

Modify object tags

Update the tags on an object by copying it to the same path with new tags:

ossutil cp oss://examplebucket1/examplefile.txt oss://examplebucket1/ --tagging "abc=1&bcd=2&……"