sync

Prev Next

Available in Classic and VPC

Sync folders and objects between Ncloud Storage buckets or between a bucket and a local directory.

Syntax

The sync syntax is as follows:

aws s3 sync \
    <source> \
    <destination> \
    [--dryrun] \
    [--quiet] \
    [--include <include>] \
    [--exclude <exclude>] \
    [--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>] \
    [--size-only] \
    [--exact-timestamps] \
    [--delete] \
    --endpoint-url <endpoint-url>

Options

This section describes the options available when running sync.

Required options

The following options are required for sync.

Options Type Required Description
<source> String Required Source path
  • Local directory or S3 URI in the format of s3://{bucket_name}[/{prefix}]
<destination> String Required Destination path
  • Local directory or S3 URI in the format of s3://{bucket_name}[/{prefix}]

Optional options

These are the optional options for sync. 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.
--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 syncing from Ncloud Storage to Ncloud Storage.
--metadata-directive String Optional Metadata handling method during sync
  • COPY (default) | REPLACE
    • COPY: Copies original.
    • REPLACE: Redefines.
--size-only Boolean Optional Determines whether to sync based solely on object size.
--exact-timestamps Boolean Optional Excludes objects of the same size from sync only if their timestamps match exactly.
  • Applies only when syncing from Ncloud Storage to a local location.
--delete Boolean Optional Deletes objects that exist only in the destination path and not in the source.

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 sync a bucket with another bucket, only objects stored in the Standard Class and restored Deep Archive Class objects are copied; objects that have not been restored are skipped, and a warning is displayed. The command example is as follows:

aws s3 sync s3://my-test-bucket s3://my-sync-bucket \
    --endpoint-url=https://kr.ncloudstorage.com

The following is an example command for syncing a local directory to a bucket while deleting objects that do not exist in the source.

aws s3 sync ./sync s3://my-sync-bucket \
    --delete \
    --endpoint-url=https://kr.ncloudstorage.com

The following is an example command for syncing objects from a bucket locally, excluding specific patterns.

aws s3 sync s3://my-sync-bucket ./ncs \
    --exclude "*img/*" \
    --endpoint-url=https://kr.ncloudstorage.com

Output

The following is an example output for syncing a bucket with another bucket.

copy: s3://my-test-bucket/sample.txt to s3://my-sync-bucket/sample.txt
copy: s3://my-test-bucket/img/copy.png to s3://my-sync-bucket/img/copy.png
copy: s3://my-test-bucket/large.bin to s3://my-sync-bucket/large.bin
warning: Skipping file s3://my-test-bucket/img/image2.png. Object is of storage class GLACIER. Unable to perform copy operations on GLACIER objects. You must restore the object to be able to perform the operation. See aws s3 copy help for additional parameter options to ignore or force these transfers.
Note

In the CLI warning message, the Deep Archive Class is listed as GLACIER.

The following is an example output of syncing a local directory with a bucket while deleting objects that do not exist in the source.

upload: sync/report.txt to s3://my-sync-bucket/report.txt
upload: sync/img/image.png to s3://my-sync-bucket/img/image.png
delete: s3://my-sync-bucket/sample.txt
delete: s3://my-sync-bucket/large.bin

The following is an example output of syncing objects from a bucket to a local storage, excluding specific patterns.

download: s3://my-sync-bucket/sample.txt to ncs/sample.txt
download: s3://my-sync-bucket/large.bin to ncs/large.bin