#!/bin/bash

# Define the target directory
TARGET_DIR="../Apr2026"
TARGET_DIR="../"
#TARGET_DIR="../../cAmerica/templateSingleNodeSLURM"

if [ ! -d "$TARGET_DIR" ]; then
    echo "Error: Directory $TARGET_DIR does not exist."
    exit 1
fi

for file in *; do
    # Skip the script itself and directories
    if [ -d "$file" ] || [ "$file" == "$0" ]; then
        continue
    fi

    if [ -f "$TARGET_DIR/$file" ]; then
        # Check if there is a difference first
        if ! diff -q "$file" "$TARGET_DIR/$file" > /dev/null; then
            echo "-------------------------------------------------------"
            echo "DIFFERENCES IN: $file"
            echo "-------------------------------------------------------"

            # -u: Unified format (standard for patches/reading)
            # --color: Adds red/green highlights if your terminal supports it
            diff -u --color "$file" "$TARGET_DIR/$file"

            echo -e "\n"
        fi
    else
        echo "[ SKIP ] $file - Not found in $TARGET_DIR"
    fi
done


