#!/bin/bash # Source folder (replace with your actual source folder path) SOURCE_FOLDER="Results/" # Destination folder (replace with your actual destination folder path) DEST_FOLDER="Simple_results" # List of specific file names to copy (replace these with the actual file names) FILES_TO_COPY=("actionTrace_Agent_PIC Blaze.csv" "GCCRaven_acstate.csv" "SNLBlaze_acstate.csv") # Create the destination folder if it doesn't exist mkdir -p "$DEST_FOLDER" # Loop through each subfolder in the source folder for SUBFOLDER in "$SOURCE_FOLDER"/*; do if [ -d "$SUBFOLDER" ]; then # Get the name of the subfolder SUBFOLDER_NAME=$(basename "$SUBFOLDER") # Create a corresponding subfolder in the destination folder mkdir -p "$DEST_FOLDER/$SUBFOLDER_NAME" # Copy the specific files if they exist in the subfolder for FILENAME in "${FILES_TO_COPY[@]}"; do SOURCE_FILE="$SUBFOLDER/$FILENAME" if [ -f "$SOURCE_FILE" ]; then cp "$SOURCE_FILE" "$DEST_FOLDER/$SUBFOLDER_NAME" else echo "File $FILENAME not found in $SUBFOLDER" fi done fi done echo "Done! Specified files have been copied to the destination folder."