I wrote the following C# code for copying blobs between storage containers in Azure. It doesnt throw any error, but it doesnt give the output either.
static void TransferBlob(string accountName, string accountKey, string containerName, string targetContainerName)
{
CloudStorageAccount storageAccount = new CloudStorageAccount(new StorageCredentials(accountName, accountKey), true);
CloudBlobClient cloudBlobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer sourceContainer = cloudBlobClient.GetContainerReference(containerName);
CloudBlobContainer targetContainer = cloudBlobClient.GetContainerReference(targetContainerName);
CloudBlockBlob sourceBlob;
CloudBlockBlob targetBlob;
foreach (var blobItem in sourceContainer.ListBlobs())
{
sourceBlob = sourceContainer.GetBlockBlobReference(blobItem.Uri.ToString());
targetBlob = targetContainer.GetBlockBlobReference(blobItem.Uri.ToString());
targetBlob.StartCopy(sourceBlob);
}
}