Skip to content

Instantly share code, notes, and snippets.

@benjamincrozat
Created August 17, 2024 10:50
Show Gist options
  • Save benjamincrozat/110558cd0960e2b30ad05b58602ba8bb to your computer and use it in GitHub Desktop.
Save benjamincrozat/110558cd0960e2b30ad05b58602ba8bb to your computer and use it in GitHub Desktop.
#!/bin/bash
# Define the output file
output_file="combined.md"
# Remove the output file if it exists to avoid including it in the search
if [ -f "$output_file" ]; then
rm "$output_file"
fi
# Find all Markdown files in subfolders, exclude the output file path, and concatenate them into one file
find . -type f -name '*.md' ! -path "./$output_file" -exec echo "Adding {} to $output_file" \; -exec cat {} + >> $output_file
echo "All Markdown files have been concatenated into $output_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment