I've managed to write a python script to list out all the blobs within a container.
import azure
from azure.storage.blob import BlobService
from azure.storage import *
blob_service = BlobService(account_name='<CONTAINER>', account_key='<ACCOUNT_KEY>')
blobs = []
marker = None
while True:
batch = blob_service.list_blobs('<CONAINER>', marker=marker)
blobs.extend(batch)
if not batch.next_marker:
break
marker = batch.next_marker
for blob in blobs:
print(blob.name)
Like I said this only lists the blobs that I want to download. I've moved onto the Azure CLI to see if that could aid in what I want to do. I'm able to download a single blob with
azure storage blob download [container]
it then prompts me specify a blob which I can grab from the python script. The way I would have to download all those blobs is to copy and paste them into the prompt after the command used above. Is there a way I can either:
A. Write a bash script to iterate through the list of blobs by executing the command, then pasting the next blob name in the prompt.
B. Specify to download the container in either the python script or Azure CLI. Is there something I'm not seeing to download the whole container?
blob_service.download_blob_to_path
? Please see an example here: azure.microsoft.com/en-in/documentation/articles/…. – Gaurav Mantri