Append a File Name


#1

I have a file converter app I use frequently that appends the file name with _converted at the end of the file name before the extension and I'd like to have a little script that will chop off the additional text. So Test_converted.mp4 would become Test.mp4 I don't need to move the file just need to rename. I've got one script that works fine when I just select a single file in Finder but doesn't work when I select more than one file so ideally I'd have one script that would work for one selected file or multiple selected files. Screenshot below where I've started trying to gleam from some other posts on here along similar lines but I've kept changing it with different bits and testing and at one point was closer than what is here but I'm trying! ha.


#2

Hey Clif,

You can't rename a file with Keyboard Maestro per se.

It works like the shell and to rename a file you “move” it to a new file with a new name.

This is one reason I prefer to use AppleScript for such things, because it actually renames the file in place.

I'm using the Keyboard Maestro Engine for regex support.

-Chris


Rename Selected Items in the Finder -- Remove String “_converted”.kmmacros (6.7 KB)


#3

THANKS! This worked absolutely perfectly and thanks for letting me know KM wouldn't do it exactly but working with AppleScripts in here or even directly with my StreamDeck work perfectly. Thanks for the help here and on the Safari bookmark one, that's two I owe you!