none
AzCopy Serverside cross account, rename blob

    Question

  • I am copying blobs from one account to another in a different region

    I want to copy all of the files in one container to a container in the other region, but I want to add a prefix to the desitation blobname.

    Source:
    containerName = document-ak-2015-01
    fileName = myfile.pdf

    Desitation:
    containerName = ak
    filename = 2015/01/myfile.pdf

    I don't see how to do this with AzCopy.

    AzCopy/Source:https://source.blob.core.windows.net/document-ak-2015-01

    /Dest:https://destination.blob.core.windows.net/ak

    /SourceKey:xxx

    /DestKey:yyy

    /Pattern:abc.txt


    Thank you, Terrence

    Wednesday, August 5, 2015 4:57 PM

Answers

  • AzCopy does not support changing the file/blob name.

    You could do this programmatically using Storage APIs, by first creating a new blob with desired name, in the destination account and then using the StartCopyFromBlob method to copy source blob content to destination blob content. See links below for details:

    https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblockblob.startcopyfromblob.aspx

    http://stackoverflow.com/questions/14152087/copying-one-azure-blob-to-another-blob-in-azure-storage-client-2-0

    Wednesday, August 5, 2015 7:21 PM

All replies

  • AzCopy does not support changing the file/blob name.

    You could do this programmatically using Storage APIs, by first creating a new blob with desired name, in the destination account and then using the StartCopyFromBlob method to copy source blob content to destination blob content. See links below for details:

    https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblockblob.startcopyfromblob.aspx

    http://stackoverflow.com/questions/14152087/copying-one-azure-blob-to-another-blob-in-azure-storage-client-2-0

    Wednesday, August 5, 2015 7:21 PM
  • Would you please tell the AzCopy team that DestinationFileName is a feature that should have been included and to add it to their todo list?

    Thank you, Terrence

    Wednesday, August 5, 2015 8:26 PM
  • >>You could do this programmatically using Storage APIs

    are the APIs Server to Server?  Or is the data going to be copied from Azure region to my computer and then back to different Azure region?


    Thank you, Terrence

    Thursday, August 6, 2015 2:40 PM
  • Command to copy from the old storage to the new storage

    AzCopy /Source:https://oldstorage.blob.core.windows.net/oldstorage  /Dest:https://newstorage.blob.core.windows.net/newstorage  /SourceKey:sourcekey /DestKey:destkey /S /XO

    Wednesday, November 14, 2018 4:11 AM