Be careful that AzCopy may not behave as you have expected…

Recursive Copy of AzCopy appends the source directory you specified to dest.

For example, the following command requires a container named abc to exist in the storage account, or the command fails.

azcopy cp --recursive /path/to/abc "https://<storage_account>.blob.core.windows.net/?sas"

Another example, the following command results in a directory named abc inside of the abc container.

azcopy cp --recursive /path/to/abc "https://<storage_account>.blob.core.windows.net/abc?sas"

To workaround this, i.e., to avoid the directory itself specified in source, use:

azcopy cp --recursive "/path/to/abc/*" "https://<storage_account>.blob.core.windows.net/abc?sas"

Note that the quotes are important, especially on Linux, as it ensures the wildcard is going to be processed by AzCopy, not the shell.

Using AzCopy to recursively copy data to file share of storage account does not include empty directories.

Even though file share of storage account supports empty directories (of course), AzCopy is blob oriented, and blob has no real concept of directory.

Reference commands:

  • AzCopy v10:

    azcopy cp --recursive /local/path/to/directory "https://<storage_account>.file.core.windows.net/?sas"
    
  • AzCopy v8:

    azcopy /S /Source:/local/path/to/directory /Dest:"https://<storage_account>.file.core.windows.net/?sas" /DestSAS:SAS
    

I've found no workaround for this… If anyone knows how to solve this, please share it in comments. I would really appreciate it.

Using AzCopy on Linux requires path like . or .. to be absolute.

An azcopy command with the following relative path specified simply errors out (as of azcopy version 10.2.1):

  • ., ./
  • .., ../
azcopy cp --recursive . "https://<storage_account>.blob.core.windows.net/?sas"

To solve this, wrap relative path with "$(realpath .)" or use absolute path directly:

azcopy cp --recursive "$(realpath .)" "https://<storage_account>.blob.core.windows.net/?sas"