Jitendra Kumar

Jitendra Kumar

  • 680
  • 2.5k
  • 720.7k

How to create the copy of container on Azure C#

Mar 30 2016 7:54 AM
I have requirement create the copy of container.
I have using the below code.
First create the container and then copy the blob file.
CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer sourceContainer = cloudBlobClient.GetContainerReference(containerName);
CloudBlobContainer targetContainer = cloudBlobClient.GetContainerReference(targetContainerName);
string blobName = "<Blob Name e.g. myblob.txt>";
CloudBlockBlob sourceBlob = sourceContainer.GetBlockBlobReference(blobName);
CloudBlockBlob targetBlob = targetContainer.GetBlockBlobReference(blobName);
but Its taking the much time. when blob file are more thousands.
so i want to copy full container not one by one blob files.

Brought to you by:

Answers (2)