Batch Copy/Delete some blobs in container

290 views Asked by At

I have a lot thousands containers and each container has up to 10k blobs inside. I have a list of tuple (container, blob) to

  1. copy to another storage
  2. delete later in the original storage

The blobs in containers are not related to each other - random date creation, random names (guids), nothing in common.

Q: is there any efficient way how to do these operations?

I already looked at az-cli and azcopy and haven't found any good way. I tried e.g. to call azcopy repeatedly for each tuple, but this would take ages. One call to copy the blob took 2sec in average. So it's nice it starts operation in background, but if this "starting operation" takes about 2 seconds, it's pretty useless for my case.

1

There are 1 answers

0
Klaas On

I'm assuming based on the comments that within each container, it's an arbitrary number (and naming) of blobs to copy and delete. And that the delete is only for the blobs copied (not the full container). If so, and want to use something besides REST one suggestion would be Powershell script to read from a file the list of blobs to copy (service side copy) and then separately do a delete (more efficient to do a copy and if successful, then delete) e.g. https://learn.microsoft.com/en-us/powershell/module/az.storage/get-azstorageblobcopystate?view=azps-4.7.0#example-4--start-copy-and-pipeline-to-get-the-copy-status

Cheers, Klaas [Microsoft]