Is there anyway safely we can extract directory path from file and create directory if not exists
Example:
path = "/a/b/c/d/e/f/1.txt"
extract_directory_path_only = path.split("/")[0:-1]
dir = "/".join(extract_directory_path_only)
Path(dir.mkdir(parents=True, exist_ok=True))