Moving an Object
Function
You can use this command to move a single object or move objects in batches by a specified object name prefix.
- Do not change the source objects in the OBS bucket when moving objects. Otherwise, the operation may fail or data may be inconsistent.
- If the storage class of the object to be moved is cold, you must restore the object first. Otherwise, the moving fails.
- The source objects are deleted after the move operation succeeds.
- If the source bucket is a parallel file system (supporting POSIX), the destination bucket cannot be an object storage bucket.
Command Line Structure
- In Windows
- Moving a single object
obsutil mv obs://srcbucket/key obs://dstbucket/[dest] [-dryRun] [-u] [-p=1] [-threshold=52428800] [-versionId=xxx] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-cpd=xxx] [-fr] [-o=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Moving objects in batches
obsutil mv obs://srcbucket[/key] obs://dstbucket[/dest] -r [-dryRun] [-f] [-flat] [-u] [-j=1] [-p=1] [-threshold=52428800] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Moving a single object
- In Linux or macOS
- Moving a single object
./obsutil mv obs://srcbucket/key obs://dstbucket/[dest] [-dryRun] [-u] [-p=1] [-threshold=52428800] [-versionId=xxx] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-cpd=xxx] [-fr] [-o=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Moving objects in batches
./obsutil mv obs://srcbucket[/key] obs://dstbucket[/dest] -r [-dryRun] [-f] [-flat] [-u] [-j=1] [-p=1] [-threshold=52428800] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Moving a single object
- The source path and destination path cannot be the same.
- The source and destination paths cannot be nested when moving objects in batches.
- Batch object move is not available for parallel file systems.
Examples
- Take the Windows OS as an example. Run the obsutil mv obs://bucket-test/key obs://bucket-test2 command to move a single object.
obsutil mv obs://bucket-test/key obs://bucket-test2 Parallel: 3 Jobs: 3 Threshold: 524288000 PartSize: 5242880 Exclude: Include: VerifyLength: false VerifyMd5: false CheckpointDir: xxxx [=====================================================] 100.00% 6/s 0s Move successfully, 19B, obs://bucket-test/key --> obs://bucket-test2/key
- Take the Windows OS as an example. Run the obsutil mv obs://bucket-test/temp/ obs://bucket-test2 -f -r command to move objects in batches.
obsutil mv obs://bucket-test/temp/ obs://bucket-test2 -f -r Parallel: 3 Jobs: 3 Threshold: 524288000 PartSize: 5242880 Exclude: Include: VerifyLength: false VerifyMd5: false CheckpointDir: xxxx OutputDir: xxxx [=============================================================] 100.00% 10/s 0s Succeed count is: 5 Failed count is: 0 Metrics [max cost:298 ms, min cost:192 ms, average cost:238.00 ms, average tps:9.71] Task id is: 0476929d-9d23-4dc5-b2f8-0a0493f027c5
Parameter Description
Parameter |
Optional or Mandatory |
Description |
---|---|---|
srcbucket |
Mandatory |
Source bucket name |
dstbucket |
Mandatory |
Destination bucket name |
dest |
Optional |
Indicates the destination object name when moving a single object, or the name prefix of destination objects when moving objects in batches. |
key |
Mandatory for moving a single object Optional for moving objects in batches |
Indicates the source object name when moving a single object, or the name prefix of source objects when moving objects in batches. The rules are as follows:
NOTE:
|
fr |
Optional for moving an object (additional parameter) |
Generates an operation result list when moving an object. |
flat |
Optional for moving objects in batches (additional parameter) |
The name prefix of the parent object is excluded when moving objects in batches. |
dryRun |
Optional (additional parameter) |
Conducts a dry run. |
u |
Optional (additional parameter) |
Indicates incremental move. If this parameter is set, each object can be moved only when it does not exist in the destination bucket, its size is different from the namesake one in the destination bucket, or it has the latest modification time.
NOTE:
If the size and modification time of the destination object are the same as those of the source object, the source object is directly deleted instead of being moved. |
p |
Optional (additional parameter) |
Indicates the maximum number of concurrent multipart move tasks when moving an object. The default value is the value of defaultParallels in the configuration file. |
threshold |
Optional (additional parameter) |
Indicates the threshold for enabling multipart move, in bytes. The default value is the value of defaultBigfileThreshold in the configuration file.
NOTE:
|
versionId |
Optional for moving an object (additional parameter) |
Source object version ID that can be specified when moving a single object
NOTE:
Parameter versionId cannot be configured for buckets that support POSIX. |
acl |
Optional (additional parameter) |
Access control policies for destination objects that can be specified when moving objects. Possible values are:
NOTE:
The preceding four values indicate private read and write, public read, public read and write, and bucket owner full control. |
sc |
Optional (additional parameter) |
Storage classes of the destination objects that can be specified when moving objects. Possible values are:
|
meta |
Optional (additional parameter) |
Metadata of destination objects that can be specified when moving objects. The format is key1:value1#key2:value2#key3:value3.
NOTE:
The preceding value indicates that the destination objects in the bucket contain three groups of customized metadata after objects are moved: key1:value1, key2:value2, and key3:value3. |
fs |
Optional (additional parameter) |
Specifies whether the method of listing parallel file systems is applied. If you are listing parallel file systems, you are recommended to add this parameter.
CAUTION:
|
ps |
Optional (additional parameter) |
Indicates the size of each part in a multipart move task, in bytes. The value ranges from 100KB to 5GB. The default value is the value of defaultPartSize in the configuration file.
NOTE:
|
cpd |
Optional (additional parameter) |
Indicates the folder where the part records reside. The default value is .obsutil_checkpoint, the subfolder in the home directory of the user who executes obsutil commands.
NOTE:
A part record is generated during a multipart move and saved to the copy subfolder. After the move succeeds, its part record is deleted automatically. If the move fails or is suspended, the system attempts to resume the task according to its part record when you perform the move the next time. |
r |
Mandatory for moving objects in batches (additional parameter) |
Moves objects in batches based on a specified name prefix of objects in the source bucket. |
f |
Optional for moving objects in batches (additional parameter) |
Runs in force mode. |
j |
Optional for moving objects in batches (additional parameter) |
Indicates the maximum number of concurrent tasks for moving objects in batches. The default value is the value of defaultJobs in the configuration file.
NOTE:
The value is ensured to be greater than or equal to 1. |
exclude |
Optional for moving objects in batches (additional parameter) |
Indicates the matching patterns of source objects that are excluded, for example: *.txt.
NOTE:
NOTICE:
|
include |
Optional for moving objects in batches (additional parameter) |
Indicates the matching patterns of source objects that are included, for example: *.jpg.
NOTE:
NOTICE:
|
timeRange |
Optional for moving objects in batches (additional parameter) |
Indicates the time range matching pattern when moving objects. Only objects whose latest modification time is within the configured time range are moved. This pattern has a lower priority than the object matching patterns (exclude/include). That is, the time range matching pattern is executed after the configured object matching patterns.
NOTE:
NOTICE:
|
mf |
Optional (additional parameter) |
Indicates that the name matching pattern (include or exclude) and the time matching pattern (timeRange) also take effect on objects whose names end with a slash (/). |
o |
Optional (additional parameter) |
Indicates the folder where operation result lists reside. After the command is executed, result lists (possibly including success, failure, and warning files) are generated in the folder. The default value is .obsutil_output, the subfolder in the home directory of the user who executes obsutil commands.
NOTE:
|
config |
Optional (additional parameter) |
User-defined configuration file for executing a command. For details about parameters that can be configured, see Configuration Parameters. |
e |
Optional (additional parameter) |
Specifies the endpoint. |
i |
Optional (additional parameter) |
Specifies the user's AK. |
k |
Optional (additional parameter) |
Specifies the user's SK. |
t |
Optional (additional parameter) |
Specifies the user's security token. |
Response
Refer to Response for uploading an object.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot