Created
July 28, 2024 20:04
-
-
Save johnwheeler/14442621b2043759bcf709623bb8896b to your computer and use it in GitHub Desktop.
This file contains 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
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