0
votes

My command is .\azcopy cp "source" "dest" --recursive=true

Where both source and dest are storage containers.

When I run the cp command, it seems like azcopy iterates over every file and transfers to destination.

Is there way to only copy the file if the file does not exist or is different in the destination?

azcopy sync does something similar, but only supports dest/origin of local/container and not container/container, as is my understanding.

3

3 Answers

1
votes

We've just added container to container support in version 10.3

0
votes

Your understanding is right, currently, the azcopy sync supports only between the local file system to the blob storage container, not container/container. Since Synchronization is one-way. As a workaround, you could perform the synchronous process in two steps by syncing from the specified blob storage source to the local file path and then syncing them to the Blob storage destination from the local file path.

Another option is to use AzCopy v8.1. The /XO and /XN parameters allow you to exclude older or newer source resources from being copied, respectively. If you only want to copy source resources that don't exist in the destination, you can specify both parameters in the AzCopy command:

/Source:http://myaccount.blob.core.windows.net/mycontainer /Dest:http://myaccount.blob.core.windows.net/mycontainer1 /SourceKey:<sourcekey> /DestKey:<destkey> /S /XO /XN
0
votes

If you want to stick with AzCopy v10, it looks like there is an --overwrite parameter which you can set to true (default), false, or prompt. By setting to false, it won't overwrite any files that already exist. However, it also won't overwrite any files which are newer in the source -- not sure if that is a deal-breaker for you.