tencent cloud


Syncing Upload/Download/Copy - sync

Last updated: 2022-05-03 10:52:28

    Command Syntax

    The sync command is used to sync object upload, download, and copy. The difference between sync and cp is that sync first compares the CRC64 value of an object with the same name that already exists, and if the value is the same, the object will not be transferred.

    ./coscli sync <source_path> <destination_path> [flag]

    sync includes the following optional flags:

    Flag Abbreviation Flag Full Name Description
    None --include Includes specific objects.
    None --exclude Excludes specific objects.
    -r --recursive Specifies whether to traverse all objects in the directory recursively
    None --storage-class Specifies the storage class for the object to upload. Default value: STANDARD
    None --part-size Part size. Default value: 32 MB; maximum value: 5 GB
    None --thread-num Number of concurrent threads. Default value: 5
    None --rate-limiting Speed limit for a single URL. Value range: 0.1–100 MB/s

    • sync automatically uses concurrent upload/download for large objects.
    • If an object is larger than --part-size, COSCLI will split the object into multiple parts according to --part-size and use --thread-num threads to concurrently upload/download the object.
    • Each thread maintains a URL. For each URL, you can use the --rate-limiting parameter to limit the speed of a single URL. When concurrent upload/download is enabled, the total rate is --thread-num * --rate-limiting.
    • If an object is uploaded/downloaded in parts, checkpoint restart will be enabled by default.
    • --include and --exclude support standard regular expression syntax, so you can use them to filter files that meet specific criteria.
    • When using zsh, you may need to add double quotes at both ends of the pattern string.
    ./coscli sync ~/test/ cos://bucket1/example/ -r --include ".*.mp4"


    Syncing object upload

    ./coscli sync ~/example.txt cos://bucket1/example.txt

    Syncing object download

    ./coscli sync cos://bucket1/example.txt ~/example.txt

    Syncing intra-bucket replication

    ./coscli sync cos://bucket1/example.txt cos://bucket1/example_copy.txt

    Syncing cross-bucket replication

    ./coscli sync cos://bucket1/example.txt cos://bucket2/example_copy.txt
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support