Q: Adding a suffix to a file using applescript
I am using a droplet/application to add a suffix to my filenames. i want it to add the word "_THUMBNAIL" before the file extension. Right now it is leaving the file extension, adding _THUMBNAIL and adding the extension again. I know part of it has to do with the "& name extension of aFile" line, but that's the only way i could get it to have the extension after the added text. Here is the script below:
on open someFiles
tell application "Finder"
set theList to someFiles
repeat with aFile in someFiles
set fName to (name of (info for aFile)) & "_THUMBNAIL" & "." & name extension of aFile
set name of aFile to fName
end repeat
end tell
end open
Any help to get this sorted would be great!
Thank you in advance.
Posted on Sep 19, 2016 10:35 AM
Replace the ‘set fName’ line with:
set fName to ((items 1 thru ((offset of "." in (get name of aFile)) - 1) of (get name of aFile)) as string) & "_THUMBNAIL" & "." & name extension of aFile
(144742)
Posted on Sep 19, 2016 10:45 AM