#!/bin/bash # Set the output file OUTPUT_FILE="code_export.txt" # Remove the output file if it exists if [ -f "$OUTPUT_FILE" ]; then rm "$OUTPUT_FILE" fi # Find all files except hidden files and directories find . -type f -not -path "*/\.*" -not -path "*node_modules*" -not -path "*vendor*" | sort | while read -r file; do # Skip the output file itself and this script if [[ "$file" == "./$OUTPUT_FILE" || "$file" == "./export_code.sh" ]]; then continue fi # Skip binary files and the output file itself if file "$file" | grep -q "binary"; then continue fi # Add the filename and content to the output file echo "\"$file\" : " >> "$OUTPUT_FILE" echo "\"\"\"" >> "$OUTPUT_FILE" cat "$file" >> "$OUTPUT_FILE" echo "\"\"\"" >> "$OUTPUT_FILE" echo "" >> "$OUTPUT_FILE" echo "" >> "$OUTPUT_FILE" done echo "Code export completed. Output saved to $OUTPUT_FILE"