Skip to content

Instantly share code, notes, and snippets.

View Slushi-Github's full-sized avatar

Andres_Github Slushi-Github

View GitHub Profile
@Slushi-Github
Slushi-Github / DirToTxtFile.py
Created March 9, 2025 18:07
a Python script that allows you to analyze a whole folder and attach it to a text file to give it as context to an artificial intelligence, like Google Gemini.
import os
import sys
def search_files_and_content(dir) -> dict:
files_content = {}
base_dir = os.path.basename(dir)
for dirpath, dirnames, filenames in os.walk(dir):
rel_path = os.path.relpath(dirpath, dir)