You are asking two different questions here. One is "How do I remove the last 10 characters of a file name" while the other is going from [RF] Happy Hour 1 [jdhf2345].mp4
→ Happy Hour 1.mp4
.
I'm not really sure which one to answer here so I guess I'll answer the first one??
"How do I remove the last 10 characters of a file name"
set myFiles to choose file with multiple selections allowed
repeat with myFile in myFiles
tell application "System Events"
set myName to the characters 1 thru ((offset of "." in (name of myFile as text)) - 1) of (name of myFile as text)
tell application "Finder"
set myExtention to name extension of (myFile as alias)
set myNewName to characters 1 thru (((length of myName) - 10) as number) of (myName as text)
set name of file (myFile as text) to (myNewName & "." & myExtention as text)
end tell
end tell
end repeat
[]
or could this be anything? Don't you want to remove the trailing space as well? What do you want to happen if there is a name conflict after the shortening? – nohillside♦ Jun 8 '18 at 12:55