Can I change the block blobs' directory? RRS feed

  • Question

  • Can I change existing block blobs' blob directory? Or I have to upload them again to the new directory then delete the original ones?
    Sunday, May 10, 2015 1:34 PM


All replies

  • Hi Xin,

    I believe you meant renaming a container.  If so, you cannot rename a container.  You will need to create a new container and copy existing data from an old container to a new one.  You can use tools like AzCopy (http://azure.microsoft.com/en-us/documentation/articles/storage-use-azcopy/) or CopyBlob API (https://msdn.microsoft.com/library/azure/dd894037?f=255&MSPPError=-2147217396).

    Sunday, May 10, 2015 9:07 PM
  • Thanks for the reply, Aung. Actually I mean moving the blob between the blob directories inside the same container. E.g.

    CloudBlobContainer testContainer = blobClient.GetContainerReference("testcontainer");
    var dir = testContainer.GetDirectoryReference("foo");
    var blobRef = dir.GetBlockBlobReference("1.jpg);
    What if now I want to move 1.jpg to the subdirectory of foo, like "foo/bar"?
    Monday, May 11, 2015 6:39 AM
  • The 'Directory' structure is just for structuring. There is no nested containers in Azure. There is no 'sub-containers'. So you will need to copy it just like you already do.

    Regards, Samir Farhat || Datacenter Consultant || The way to share my knowldge with the community https://buildwindows.wordpress.com

    • Marked as answer by Xin.Peng Tuesday, May 12, 2015 7:25 AM
    Monday, May 11, 2015 9:25 AM
  • Hi Samir, I was thinking the "directory" is just a segment of the blob's URL, so update it is just updating the URL to the blob, although I didn't find any API for this. Thanks for confirming this.

    Monday, May 11, 2015 10:05 AM