How to move blobs between Azure blob storage containers in java

Kosala De Silva 41 Reputation points
2020-09-01T05:53:07.08+00:00

I have two containers under same storage account. I am trying to move a certain blob from one container to other (release to backup). Right now what I do is download the file from release container and then upload it back again to the backup container. Then I delete the file from release container.

sourceBlobClient.downloadToFile(FILE_LOCAL);
destBlobClient.uploadFromFile(FILE_LOCAL);
sourceBlobClient.delete();

This works but I think there should be a more straight forward way to do this. (copy or move the file from one container to another without downloading the file).

Any help regarding this is much appreciated.

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,787 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sumarigo-MSFT 45,781 Reputation points Microsoft Employee
    2020-09-01T06:27:15.4+00:00

    @Kosala De Silva There is similar discussion in SO can you refer to the suggestion and let me know the status
    Additional information: Have you check Azcopy tool, one of the best to tool to move/copy data

    If the above suggestion doesn't help can you provide the complete code? Could you please reach to me via AZCommunity[AT]microsoft.com with a link to this Issue as well as your subscription ID and pease mention "ATTN subm" in the subject field. We would like to work closer with you on this matter.

    Could you please tell me what version of your jdk and azure-storage-blob are using? As I understand delete operation is failing and code sample executes successfully am I correct?

    Hope this helps!

    Kindly let us know if the above helps or you need further assistance on this issue.

    ---------------------------------------------------------------------------------------------------------------

    Please don’t forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.