The goal of the snippet is to check each item for "# ", if found I'd like to then use the rest of the item will become the directory that new files will be saved to. This will be a markdown parser with the ability to update existing files, so i need to be able to turn the files into lists to compare and insert or just create a new document This is where ive become stuck, i do have a working parser but it only works if creating new files, adding in the ability to merge has been a wall fileA_contents = [] fileA_read = file.readlines() fileA_contents.append(fileA_read) print(fileA_contents) for item in fileA_contents: if item[0:1] == "# ": print("found") current_directory = folder+item[2:]+"/" #os.makedirs(folder+item[2:], exist_ok=True) print(current_directory) Continue reading...