#!/bin/bash # Script to copy eveai_chat_client/static files to nginx/static # without overwriting existing files SRC_DIR="../eveai_chat_client/static/assets" DEST_DIR="../nginx/static/assets" # Check if source directory exists if [ ! -d "$SRC_DIR" ]; then echo "Error: Source directory $SRC_DIR does not exist!" exit 1 fi # Create destination directory if it doesn't exist if [ ! -d "$DEST_DIR" ]; then echo "Destination directory $DEST_DIR does not exist. Creating it..." mkdir -p "$DEST_DIR" fi # Function to recursively copy files without overwriting copy_without_overwrite() { local src=$1 local dest=$2 # Loop through all items in source directory for item in "$src"/*; do # Get the filename from the path base_name=$(basename "$item") # If it's a directory, create it in the destination and recurse if [ -d "$item" ]; then if [ ! -d "$dest/$base_name" ]; then echo "Creating directory: $dest/$base_name" mkdir -p "$dest/$base_name" fi copy_without_overwrite "$item" "$dest/$base_name" else # If it's a file and doesn't exist in the destination, copy it cp "$item" "$dest/$base_name" fi done } # Start the copy process echo "Starting to copy files from $SRC_DIR to $DEST_DIR..." copy_without_overwrite "$SRC_DIR" "$DEST_DIR" echo "Copy completed!"