Ever felt like you have to provide your file structure to ChatGPT or Claude so that they can better understand and help you in your project? Well, I used this script to do it for one of my recent projects and helped me to not overexplain every detail to the AI and help it understand where all I need to apply changes.
import os
import fnmatch
def print_file_structure(root_dir, exclude_dirs=None, exclude_files=None, save_to_file=False, output_filename="file_structure.txt", prefix="", file=None):
"""