Batch Rename Files in the Finder

In Yosemite, the Finder finally allows Batch Rename of files by control-clicking on a set of files.

However, the options are fairly limited and their is no preview at all. The end of the TidBITS article and the comments list various third party applications, but I've been using this macro for quite a while and it works well.

It prompts for the search and replace formats, and then asks for each file whether you wish to rename to a specific new name. You can click "Rename All" once you're satisfied your replacement is correct.

There are no options for adding an index or a date, but allowing regular expressions lets you do a fair number of things, and if an index or date was important to you it would not be hard to add a step to the macro that replaced some resulting fixed string with an index or a date.

Rename Files.kmmacros (7.8 KB)


This is fantastic Peter, almost what I was looking for and better in some ways. Thanks for sharing.

Peter I didn’t know about the addition to the Finder. It’s about time. Great script by the way.

I noticed something as I imported it. I had selected a group I wanted to add it to. When the macro imported it actually created a new group called “Finder”. Is this the group you had originally assigned it to?

Yeah, macros import where they were originally, when they were exported. If you want more control over that, see this:


I may. However I am trying to hold back on importing everything so I can stay more focused. I am also trying to finish reading the manual. (If I could just stop reading this darn forum!) I think I can make better use and choose macros I need much more wisely if I understand it better.

For me this is a character flaw. I bought a Mac to start creating music. Upon first using it I realized "I don't know anything about this Mac and I need to learn more in order to use it effectively." Two years later, I still hadn't created music. (I think people call this ADD?) Heh! Anyway I try and create lists of what I need to do and stick to it. It's even harder now with my daughter coming in every once in a while, wanting to show me things or asking for help with something. Yet I attempt to persist.

1 Like

I totally get what you’re saying. I’m the same way.

But here’s the problem, when it comes to KM. You can’t just sit down and read the manual. You only learn by doing things. And for me, the only way I do things, is to do them when I need them, which is often when I’m in the middle of something else.

For example, I’m in the middle of something now, but I’m going to stop and work on the Palettes tutorial, because I’ve been meaning to for a long time, and I never get around to it.

So here’s what I do instead: I leave myself breadcrumbs. Notes that will lead me back to whatever I was working on when I jumped down a rabbit trail. Sometimes it gets 5 or 6 holes deep, or even deeper. But I can always find my way back.


I'd put that a little differently.

You can only learn so much by reading the manual.

It's a good idea to read through it and become generally familiar with Keyboard Maestro's capabilities and terminology, but the real learning comes from constructing your own macros and from deconstructing other people's to see how they work.



This no longer works for me, as the Finder says "destination already exists".


Hey @aeko,

What version of Keyboard Maestro are you using?

What version of macOS?


macOS 10.13.6
KM 8.2.4

Hey @aeko,

I just tried the macro on macOS 10.12.6, and it worked fine.

It does complain if one or more files is not renamed, but it renames files correctly with plain-text and RegEx with my tests (so far).

Please provide exact examples of what is not working for you.


2 posts were split to a new topic: Managing Software Development

A post was merged into an existing topic: Managing Software Development

Has the "Rename Files" macro been moved somewhere else? I get an error when I click on it to download...

Sigh - the forum seems to have lost the file (even though it is still there on the server). I have asked on the Discourse support how to resolve the issue.


Huh, okay, I’ll wait to hear of a resolution. Thanks!

Still no word on making this macro available again?

Is it not in your built-in macro library?

Just in case it's not, here's the version on my system:

Rename Files.kmmacros (7.2 KB)


Well, duh, it sure is! I had no idea, but am all set now!

Thanks, @gglick!

1 Like

This is such a useful macro, i use it a lot, thanks!
Just wondering how would one go about being able to write an undo functionality to this script? Perhaps listing the old names in a clipboard, then the renamed ones in another, then revert back to the original?