I found a script here
that I changed to this:
tell application "Finder"
set the chosen_folder to (choose folder with prompt "Pick the folder containing the files :")
repeat with i from 1 to count of file in chosen_folder
set this_text to name of file i of chosen_folder
set AppleScript's text item delimiters to ".xyz"
set AppleScript's text item delimiters to "/"
set this_text to every text item of this_text
if (count of characters of this_text) > 27 then
set this_text to (characters 1 thru 27 of this_text)
set AppleScript's text item delimiters to ""
set name of file i of chosen_folder to this_text & ".abc" as string
After booting into System 9, I created four SimpleText documents, each with the suffix .xyz, and dropped them into a folder. Then I pasted the above script into a blank Script Editor document and clicked on "Run." A dialog popped up asking me to click on the folder with the documents, and lo and behold, the script changed each one. Colour me astonished.
Before running it on your important files, you should try it first with dummy documents, just to be sure it will work properly with your version of AppleScript.
You'd likely have to change the number 27 to whatever number of documents are in the folder.
I spoke too soon. I tried it a second time, and it's adding the second suffix to the first. I'll keep working on it.