I'm looking for an approach to move a blob in Azure from one container to another. The only solution I found is to use the Azure Storage Data Movement Library, but this seems to work between different accounts. I would like to move the blob within the same account to an other container.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- running headless chrome in an microsoft azure web
- Docker task in Azure devops won't accept "$(pw
I have not used
Azure Storage Data Movement Library
but I am pretty sure that it will work in the same storage account as well.Coming to your question, since
Move
operation is not natively supported by Azure Storage what you can do is implement this by invokingCopy Blob
followed byDelete Blob
. In generalCopy
operation is async however when a blob is copied in same storage account, it is a synchronous operation i.e. copy happens instantaneously. Please see sample code below which does just this:However, please keep in mind that you use this code only for moving blobs in the same storage account. For moving blobs across storage account, you need to ensure that copy operation is complete before you delete the source blob.
Here is what worked for me (answer edited after better answer by @Deumber was posted):
The answer accepted in this question will move the file to your server memory and then upload the file again to azure.
It's better let the work to azure