File size: 791 Bytes
2ea1065
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash

source_folder="open_domain/SODA/test"  # Replace "path/to/source_folder" with the actual path

# Check if the source folder exists
if [ ! -d "$source_folder" ]; then
    echo "Source folder not found: $source_folder"
    exit 1
fi

# Loop through the files matching the pattern dialogs_*.json in the source folder
for file in "$source_folder"/dialogs_*.json; do
    # Check if the file exists
    if [ -e "$file" ]; then
        # Extract the number from the current file name
        number=$(echo "$file" | grep -oE '[0-9]+')

        # Create the new file name with the "s" added to "dialogs"
        new_name="${source_folder}/dialogues_${number}.json"

        # Rename the file
        mv "$file" "$new_name"

        echo "Renamed: $file -> $new_name"
    fi
done