mv

Prev Next

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
  • Local path or S3 URI in the format of s3://{bucket_name}[/{object_name}]
<destination> String Required Destination path
  • Local path or S3 URI in the format of s3://{bucket_name}[/{object_name}]

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.
  • Applied in the specified order.
--exclude String Optional Excludes objects matching the specified pattern from the command.
  • Applied in the specified order.
--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
  • Default: --follow-symlinks
  • Applies only when uploading objects from the local file system.
--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.
  • STANDARD (default) | ONEZONE_IA | DEEP_ARCHIVE
--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
  • Not applied if --quiet or --only-show-errors is specified
--page-size Integer Optional Number of items per page
  • 1-1000
--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.
  • none | metadata-directive | default (default)
    • none: Does not copy attributes.
    • metadata-directive: Copies content-related attributes and metadata.
    • default: Copies and adds tags to attributes targeted by metadata-directive.
  • Applies only when moving from Ncloud Storage to Ncloud Storage.
--metadata-directive String Optional Metadata handling method during migration
  • COPY (default) | REPLACE
    • COPY: Copies original.
    • REPLACE: Redefines.

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