I have a Python script that loads files into a folder hierarchy in an Azure storage container/blob storage. The folder hierarchy structure is High-level-folder_name/Year/Month/Day/filename.json. For example : data/Scanner/2022/07/15/scanner23_30_45_21.json
New folders are added to the hierarchy, based on the current date. My code works, but for some reason a folder with a link to the top of the container hierarchy is also created at each level of the folder structure. See image below
My code is below. Any ideas on what is causing the links to upper level of the hierarchy would be appreciated.
*I have a feeling this issue is linked to the Blob service being based on a flat storage scheme (rather than hierarchical scheme). Link here With help of Python, how can I create dynamic subfolder under Azure Blobstorage?
import os
from pathlib import Path
from datetime import datetime
import json
from azure.storage.blob import BlobClient
#file name
datetime_string = datetime.utcnow().strftime("%Y_%m_%d-%I_%M_%S_%p")
#folders that the files foes in Year -> months -Filename.json
year_utc = datetime.utcnow().strftime("%Y")
month_utc = datetime.utcnow().strftime("%m")
filename_prefix =f"Scanner/{year_utc}/{month_utc}/{datetime_string}.json"
data = json.dumps("test_content_of_file",indent = 4)
blob = BlobClient.from_connection_string(conn_str="Connectionstringetc",
container_name="data", blob_name= filename_prefix)
blob.upload_blob(data, overwrite=False)