from pathlib import Path

path_dir = Path("/Users/normrasmussen/Documents/Work/CustomerNotes/")
toc_file = Path("/Users/normrasmussen/Documents/Work/CustomerNotes/index.md")


def company_path(path_dir):
    listdirs = [x for x in path_dir.iterdir() if x.is_dir()]
    for dirs in listdirs:
        company_list = []
        str_dirs = str(dirs)
        str_dirs = str_dirs.split("/")[6]
        company_list.append(str_dirs)
        listfiles = list(dirs.glob("**/*.*"))
        for item in listfiles:
            company_list.append(item)
    write_to_toc(company_list, toc_file)


def write_to_toc(company_list, toc_file):
    pass
    # file = open(toc_file, "a")
    # file.write(str_dirs)
    # file.close()


if __name__ == "__main__":
    company_path(path_dir)
