File size: 1,260 Bytes
667cfa6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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."