Skip to content

Instantly share code, notes, and snippets.

@l-portet
Created June 20, 2023 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save l-portet/0308ab13a4b2a25b3f31f74def7b8f54 to your computer and use it in GitHub Desktop.
Save l-portet/0308ab13a4b2a25b3f31f74def7b8f54 to your computer and use it in GitHub Desktop.
Export files for ChatGPT
#!/bin/bash
# this script recursively exports all files in a directory
# the output will be copied your clipboard using a format
# that's easy to be interpreted by LLMs like chatgpt
function print_files {
for entry in "$1"/*
do
if [ -d "$entry" ]; then
print_files "$entry"
elif [ -f "$entry" ]; then
echo "===== $(realpath "$entry") ====="
cat "$entry"
fi
done
}
# if not macOS, change pbcopy to your clipboard manager
print_files $1 | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment