SalesforceDialogStudio / uniform_file_name.sh
mzozulia's picture
Upload 339 files
2ea1065
#!/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