12345678910 |
- def download_directory_from_blob(source, download_directory_path):
- container_client = ContainerClient.from_connection_string(conn_str=connect_str, container_name=container_name)
- print(f"\nDownloading all blobs from the following directory {source} in container {container_name}")
- blob_list = container_client.list_blobs()
- for blob in blob_list:
- if source in blob.name:
- blob_client = blob_service_client.get_blob_client(container=container_name, blob=blob.name)
- os.makedirs(os.path.dirname(blob.name), exist_ok=True)
- with open(blob.name, "wb") as download_file:
- download_file.write(blob_client.download_blob().readall())
|