Created
June 20, 2023 06:42
-
-
Save l-portet/0308ab13a4b2a25b3f31f74def7b8f54 to your computer and use it in GitHub Desktop.
Export files for ChatGPT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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