Available in Classic and VPC
Move an object stored as a local file or in Ncloud Storage to another location.
Syntax
The mv syntax is as follows:
aws s3 mv \
<source> \
<destination> \
[--dryrun] \
[--quiet] \
[--include <include>] \
[--exclude <exclude>] \
[--recursive] \
[--follow-symlinks | --no-follow-symlinks] \
[--no-guess-mime-type] \
[--storage-class <storage-class>] \
[--content-type <content-type>] \
[--cache-control <cache-control>] \
[--content-disposition <content-disposition>] \
[--content-encoding <content-encoding>] \
[--content-language <content-language>] \
[--only-show-errors] \
[--no-progress] \
[--page-size <page-size>] \
[--ignore-glacier-warnings] \
[--metadata <metadata>] \
[--copy-props <copy-props>] \
[--metadata-directive <metadata-directive>] \
--endpoint-url <endpoint-url>
Options
This section describes the options available when running mv.
Required options
The following options are required for mv.
| Options | Type | Required | Description |
|---|---|---|---|
<source> |
String | Required | Source path
|
<destination> |
String | Required | Destination path
|
Optional options
These are the optional options for mv. Options that are not specified will use their default values.
| Options | Type | Required | Description |
|---|---|---|---|
--dryrun |
Boolean | Optional | Checks the results of the command without actually executing it. |
--quiet |
Boolean | Optional | Does not display the response. |
--include |
String | Optional | Includes only objects matching the specified pattern in the command.
|
--exclude |
String | Optional | Excludes objects matching the specified pattern from the command.
|
--recursive |
Boolean | Optional | Navigates to subitems in the specified path. |
--follow-symlinks, --no-follow-symlinks |
Boolean | Optional | Whether to upload the content of files pointed to by symbolic links
|
--no-guess-mime-type |
Boolean | Optional | Disables automatic guessing of the content type for objects to be uploaded. |
--storage-class |
String | Optional | Specifies the storage class for the object.
|
--content-type |
String | Optional | Define explicit content type. |
--cache-control |
String | Optional | Set caching behavior. |
--content-disposition |
String | Optional | Specifies how to display objects. |
--content-encoding |
String | Optional | Set content encoding. |
--content-language |
String | Optional | Set content language. |
--only-show-errors |
Boolean | Optional | Displays only errors; other response values are not displayed. |
--no-progress |
Boolean | Optional | Does not display file transfer progress
|
--page-size |
Integer | Optional | Number of items per page
|
--ignore-glacier-warnings |
Boolean | Optional | Does not display warnings regarding unsupported operations (such as copying, downloading, or moving) on objects in the Deep Archive. |
--metadata |
String | Optional | Set up metadata to store with the object. |
--copy-props |
String | Optional | Configures the attribute values to copy from the source object.
|
--metadata-directive |
String | Optional | Metadata handling method during migration
|
Common options
For information about the options common to all aws subcommands, see Ncloud Storage options.
Examples
If the request is successful, the source path and destination path are displayed along with the type of job performed.
Command
When you move a local file to a bucket, the object is uploaded to the bucket and the local file is deleted. The command example is as follows:
aws s3 mv report.txt s3://my-test-bucket/docs/report.txt \
--endpoint-url=https://kr.ncloudstorage.com
If you move all folders and their sub-objects stored in a bucket to your local machine, the objects are saved locally and the objects in the bucket are deleted. Even if you move all objects, the bucket and folders remain intact; for buckets with versioning enabled, a delete marker is added to the moved objects. The command example is as follows:
aws s3 mv s3://my-test-bucket ./ \
--recursive \
--endpoint-url=https://kr.ncloudstorage.com
Output
The following is an example output for moving a local file to a bucket.
move: ./report.txt to s3://my-test-bucket/docs/report.txt
The following is an example output for moving all folders and their subobjects stored in the bucket to a local location.
move: s3://my-test-bucket/sample.txt to ./sample.txt
move: s3://my-test-bucket/docs/report.txt to docs/report.txt
move: s3://my-test-bucket/img/image.png to img/image.png