All Products
Search
Document Center

Object Storage Service:sync (Synchronize OSS files to an on-premises folder)

Last Updated:Mar 20, 2026

The ossutil sync command copies new and updated objects from an OSS bucket path to an on-premises folder. It does not delete local files that no longer exist in OSS unless you use --delete.

Prerequisites

Before you begin, ensure that you have:

Syntax

ossutil sync <cloud_url> <file_url> [options]
ParameterTypeDescription
cloud_urlstringThe OSS source path. Format: oss://bucketname/path/. If the path does not end with /, ossutil adds one automatically. Example: oss://examplebucket/exampledir/
file_urlstringThe local destination folder. Example: /localfolder/ (Linux) or D:\localfolder\ (Windows)

Examples

Download all objects from an OSS path to a local folder:

ossutil sync oss://examplebucket/localdir/ D:\destdir\

Only objects that are missing locally or differ in size or modification time are downloaded. The output lists each transferred object:

download: oss://examplebucket/localdir/report.pdf to D:\destdir\report.pdf
download: oss://examplebucket/localdir/data.csv to D:\destdir\data.csv

Sync and move deleted objects to a backup folder instead of leaving them locally:

ossutil sync oss://examplebucket/localdir/ D:\destdir\ --delete --backup-dir backup/

Without --backup-dir, --delete permanently removes local files that no longer exist in OSS.

Warning

--delete can result in permanent data loss. Test on a small subset first before applying it to production data.

Usage notes

  • `-u, --update`: Sends at least one HEAD request per object to check the modification time, even if the object already exists locally. In scenarios with few data changes, this generates many requests and may incur extra request fees. If a local file has the same modification time as the OSS object, the file is still updated. Evaluate your use case before enabling this option.

  • `--max-sync-num`: The default is 2,000,000. The maximum is 5,000,000.

  • `--bigfile-threshold`: Objects larger than this threshold (default: 104,857,600 bytes) use multipart upload, download, or copy automatically.

Options

Sync behavior

OptionTypeDescription
--deleteflagDeletes local files that do not exist in OSS. Use with --backup-dir to preserve deleted files.
--backup-dirstringMoves files that would be deleted by --delete to this directory instead.
-u, --updateflagSkips local files that are newer than the OSS object. If the modification times are equal, the file is still updated.
--ignore-existingflagSkips all local files that already exist, regardless of modification time.
--size-onlyflagTransfers only objects whose size differs from the local file.
--checksumflagTransfers only objects whose size and checksum (if available) differ from the local file. Valid only for object-to-object copies.
--max-sync-numintMaximum number of objects to sync. Default: 2,000,000. Maximum: 5,000,000.

Filtering

OptionTypeDescription
--includestringArrayInclusion rules for paths or file names.
--include-fromstringArrayReads inclusion rules from a file.
--excludestringArrayExclusion rules for paths or file names.
--exclude-fromstringArrayReads exclusion rules from a file.
--filterstringArrayFiltering rules for paths or file names.
--filter-fromstringArrayReads filtering rules from a file.
--files-fromstringArrayReads a list of source object names from a file. Empty and commented lines are ignored.
--files-from-rawstringArrayReads a list of source object names from a file.
--min-sizeSizeSuffixTransfers only objects at or above this size. Default unit: bytes. Supports suffixes: B, K, M, G, T, P. 1 K = 1,024 B.
--max-sizeSizeSuffixTransfers only objects at or below this size. Default unit: bytes. Supports suffixes: B, K, M, G, T, P.
--min-ageDurationTransfers only objects modified before the specified interval. Default unit: seconds. Example: --min-age 1h transfers only objects modified 1 hour ago or earlier.
--max-ageDurationTransfers only objects modified within the specified interval. Default unit: seconds. Example: --max-age 1h transfers only objects modified within the last hour.
--min-mtimeTimeTransfers only objects modified after the specified UTC time. Format: 2006-01-02T15:04:05.
--max-mtimeTimeTransfers only objects modified before the specified UTC time. Format: 2006-01-02T15:04:05.
--start-afterstringReturns objects whose names are alphabetically after the specified value.
--end-withstringReturns objects whose names are alphabetically at or before the specified value.
--metadata-includestringArrayInclusion rules for object metadata.
--metadata-excludestringArrayExclusion rules for object metadata.
--metadata-filterstringArrayFiltering rules for object metadata.
--metadata-filter-fromstringArrayReads object metadata filtering rules from a file.

Performance

OptionTypeDescription
-j, --jobintNumber of concurrent tasks for multi-object operations. Default: 3.
--parallelintNumber of concurrent tasks for a single object.
--bigfile-thresholdintSize threshold (in bytes) above which multipart upload, download, or copy is used. Default: 104,857,600.
--part-sizeSizeSuffixPart size for resumable operations. Default: calculated from file size. Range: 100 KiB–5 GiB.
--page-sizeintMaximum number of objects listed per page during batch operations. Default: 1,000. Range: 1–1,000.
--no-progressflagSuppresses the progress bar.

Object properties

OptionTypeDescription
--aclstringAccess control list (ACL) of the object. Values: private, public-read, public-read-write, default (inherits bucket ACL).
--storage-classstringStorage class of the object. Values: Standard, IA (Infrequent Access), Archive, ColdArchive, DeepColdArchive.
--metadatastringsUser metadata of the object. Format: key=value.
--metadata-directivestringHow to set metadata on the destination object. Values: COPY, REPLACE.
--taggingstringsTags for the object. Format: key=value.
--tagging-directivestringHow to set tags on the destination object. Values: COPY, REPLACE.
--copy-propsstringProperties to copy from the source object. Values: none, metadata, default.
--cache-controlstringCaching behavior when the object is downloaded by a browser.
--content-dispositionstringHow the object is displayed.
--content-encodingstringEncoding format of the object.
--content-typestringContent type of the object.
--expiresstringAbsolute expiration time for cached content.

Other options

OptionTypeDescription
-d, --dirsflagLists files and immediate subdirectories only, without recursing into subdirectories.
--encoding-typestringEncoding type for object names or file names. Valid value: url.
-f, --forceflagProceeds without a confirmation prompt.
--list-objectsflagUses the ListObjects API to list objects.
--checkpoint-dirstringDirectory for checkpoint files used in resumable operations. Default: .ossutil_checkpoint/.
-r, --recursiveflagApplies the operation recursively to all matching objects in the bucket.
--request-payerstringPayment method for the request. Set to requester to enable pay-by-requester mode.

For the full list of options, see Command-line options.

What's next