blob-upload-4_2.py 505 B

123456789
  1. def upload_directory_to_blob(upload_file_path, target): #directory name -> directory name
  2. print("\nUploading directory to Azure Storage as blob:\n\t" + upload_file_path)
  3. files = os.listdir(upload_file_path)
  4. for dir in files:
  5. file_name = upload_file_path + '/' + dir
  6. target_ = target+ '/' + dir
  7. blob_client = blob_service_client.get_blob_client(container=container_name, blob=target_)
  8. with open(file_name, "rb") as data:
  9. blob_client.upload_blob(data)