Skip to content

Instantly share code, notes, and snippets.

@johnwheeler
Created July 28, 2024 20:04
Show Gist options
  • Save johnwheeler/14442621b2043759bcf709623bb8896b to your computer and use it in GitHub Desktop.
Save johnwheeler/14442621b2043759bcf709623bb8896b to your computer and use it in GitHub Desktop.
output_file="/Users/jwheeler/Desktop/combined_src_files.txt"
www_src_directory="/Users/jwheeler/Projects/demofun/www/src"
api_src_directory="/Users/jwheeler/Projects/demofun/api/src"
# Clear the output file if it already exists
> "$output_file"
# Function to process files
process_files() {
local directory=$1
local file_extension=$2
find "$directory" -name "*.$file_extension" -type f | while read -r file; do
echo "-- $file --" >> "$output_file"
cat "$file" >> "$output_file"
echo "" >> "$output_file" # Add a blank line after each file
done
}
# Process JavaScript files from www/src
process_files "$www_src_directory" "js"
# Process Python files from api/src
process_files "$api_src_directory" "py"
echo "All .js and .py files have been combined into $output_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment