I have a directory in azure with filenames like topview/<some id>_topview.png
(i.e. within topview
directory). The files are image files. I want to wrote a script which, given a list of fetches the image files which exists in azure.
blob_service_client = BlobServiceClient.from_connection_string(imagedata_acc_string)
container_client = blob_service_client.get_container_client(imagedata_acc_container)
topviewfilepath = "gt" + "/" + id + "_topview.png" #
blobfilepath = "topview/" + id + "_topview.png"
blob_client = container_client.get_blob_client(blobfilepath)
with open(topviewfilepath, "wb") as data:
myblob = blob_client.download_blob()
myblob.readinto(data)
I want to check if the blob exists in azure before downloading it (because if it doesnt exist, it throws an error) and stops.
I tried blob_client.exist()
but it is just the client and not the file. I want to check if the file in itself exists.
I checked these links but still cant figure the exact command: