Skip to content

Instantly share code, notes, and snippets.

@flaviodelima
flaviodelima / join_files.py
Created May 15, 2025 19:16
📂 Combine text files from a directory with start/end markers - Useful for code analysis by LLMs - The CLI is then run with this format: python join_files.py -d <directory> -e <extension> <output_file>
import argparse
from pathlib import Path
import sys
def validate_directory(directory_path):
"""Check if the directory exists and is valid."""
if not directory_path.is_dir():
print(f"Error: Directory '{directory_path}' does not exist.", file=sys.stderr)
sys.exit(1)