azcopy sync

Replicates the source location to the destination location.


The last modified times are used for comparison. The file is skipped if the last modified time in the destination is more recent.

The supported pairs are:

  • local <-> Azure Blob (either SAS or OAuth authentication can be used)
  • Azure Blob <-> Azure Blob (Source must include a SAS or is publicly accessible; either SAS or OAuth authentication can be used for destination)
  • Azure File <-> Azure File (Source must include a SAS or is publicly accessible; SAS authentication should be used for destination)

The sync command differs from the copy command in several ways:

  1. By default, the recursive flag is true and sync copies all subdirectories. Sync only copies the top-level files inside a directory if the recursive flag is false.
  2. When syncing between virtual directories, add a trailing slash to the path (refer to examples) if there's a blob with the same name as one of the virtual directories.
  3. If the 'deleteDestination' flag is set to true or prompt, then sync will delete files and blobs at the destination that are not present at the source.


If you don't specify a file extension, AzCopy automatically detects the content type of the files when uploading from the local disk, based on the file extension or content (if no extension is specified).

The built-in lookup table is small, but on Unix, it's augmented by the local system's mime.types file(s) if available under one or more of these names:

  • /etc/mime.types
  • /etc/apache2/mime.types
  • /etc/apache/mime.types

On Windows, MIME types are extracted from the registry.

azcopy sync <source> <destination> [flags]


Sync a single file:

azcopy sync "/path/to/file.txt" "https://[account][container]/[path/to/blob]"

Same as above, but this time, also compute MD5 hash of the file content and save it as the blob's Content-MD5 property:

azcopy sync "/path/to/file.txt" "https://[account][container]/[path/to/blob]" --put-md5

Sync an entire directory including its sub-directories (note that recursive is on by default):

azcopy sync "/path/to/dir" "https://[account][container]/[path/to/virtual/dir]"


azcopy sync "/path/to/dir" "https://[account][container]/[path/to/virtual/dir]" --put-md5

Sync only the top files inside a directory but not its sub-directories:

azcopy sync "/path/to/dir" "https://[account][container]/[path/to/virtual/dir]" --recursive=false

Sync a subset of files in a directory (For example: only jpg and pdf files, or if the file name is "exactName"):

azcopy sync "/path/to/dir" "https://[account][container]/[path/to/virtual/dir]" --include="*.jpg;*.pdf;exactName"

Sync an entire directory, but exclude certain files from the scope (For example: every file that starts with foo or ends with bar):

azcopy sync "/path/to/dir" "https://[account][container]/[path/to/virtual/dir]" --exclude="foo*;*bar"

Sync a single blob:

azcopy sync "https://[account][container]/[path/to/blob]?[SAS]" "https://[account][container]/[path/to/blob]"

Sync a virtual directory:

azcopy sync "https://[account][container]/[path/to/virtual/dir]?[SAS]" "https://[account][container]/[path/to/virtual/dir]" --recursive=true

Sync a virtual directory that has the same name as a blob (add a trailing slash to the path in order to disambiguate):

azcopy sync "https://[account][container]/[path/to/virtual/dir]/?[SAS]" "https://[account][container]/[path/to/virtual/dir]/" --recursive=true

Sync an Azure File directory (same syntax as Blob):

azcopy sync "https://[account][share]/[path/to/dir]?[SAS]" "https://[account][share]/[path/to/dir]" --recursive=true


If include/exclude flags are used together, only files matching the include patterns would be looked at, but those matching the exclude patterns would be always be ignored.


--block-size-mb float Use this block size (specified in MiB) when uploading to Azure Storage or downloading from Azure Storage. Default is automatically calculated based on file size. Decimal fractions are allowed (For example: 0.25).

--check-md5 string Specifies how strictly MD5 hashes should be validated when downloading. This option is only available when downloading. Available values include: NoCheck, LogOnly, FailIfDifferent, FailIfDifferentOrMissing. (default 'FailIfDifferent'). (default "FailIfDifferent")

--delete-destination string Defines whether to delete extra files from the destination that are not present at the source. Could be set to true, false, or prompt. If set to prompt, the user will be asked a question before scheduling files and blobs for deletion. (default 'false'). (default "false")

--exclude-attributes string (Windows only) Exclude files whose attributes match the attribute list. For example: A;S;R

--exclude-path string Exclude these paths when copying. This option does not support wildcard characters (*). Checks relative path prefix(For example: myFolder;myFolder/subDirName/file.pdf). When used in combination with account traversal, paths do not include the container name.

--exclude-pattern string Exclude files where the name matches the pattern list. For example: .jpg;.pdf;exactName

-h, --help help for sync

--include-attributes string (Windows only) Include only files whose attributes match the attribute list. For example: A;S;R

--include-pattern string Include only files where the name matches the pattern list. For example: .jpg;.pdf;exactName

--log-level string Define the log verbosity for the log file, available levels: INFO(all requests and responses), WARNING(slow responses), ERROR(only failed requests), and NONE(no output logs). (default INFO). (default "INFO")

--put-md5 Create an MD5 hash of each file, and save the hash as the Content-MD5 property of the destination blob or file. (By default the hash is NOT created.) Only available when uploading.

--recursive True by default, look into sub-directories recursively when syncing between directories. (default true). (default true)

Options inherited from parent commands

Option Description
--cap-mbps uint32 Caps the transfer rate, in megabits per second. Moment-by-moment throughput might vary slightly from the cap. If this option is set to zero, or it is omitted, the throughput isn't capped.
--output-type string Format of the command's output. The choices include: text, json. The default value is "text".

See also