Renaming multiple files with strings

What might I do to make this rename one string to another?

e.g. "`,C4,B3" becomes "_60,59"

Rename string.kmmacros (3.8 KB)

Hey @mftr,

It's not quite clear what you want from your question and the given macro, but...

Keyboard Maestro can do a literal search and replace and can also use regular expressions, so you can get pretty creative.

If you need more help then please provide a couple of good real-world examples of before and after file names.

-Chris

Hey Chris, sorry for the late reply.

Here's an example:

a few thousand files that all contain either vl=1, vl=2, vl=3, vl=4, or vl=5 need to be renamed vl_1-32, vl_33-50, vl_51-69, vl_70-99, vl_100-127, respectively.

This should get you started.
Note that you will need to add more Search/Replace Actions for all of your cases.

MACRO:   Replace Text in Finder Selection [Example]


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/3/7/37fb2ee08dfd7e51845c499d1d9eff102113c758.kmmacros">Replace Text in Finder Selection [Example].kmmacros</a> (5.6 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|535x1194](upload://te4TxLDdb2oXKb3BVXj7DMxEMZ2.jpeg)

---

Questions?

thanks for that!

So it looks like it just sends the files into the ether. When I run the script the filename stays the same, but the file size changes to "zero bytes." I should add that I was hoping to use this with files that also contain other tags as well, but to just affect the variables that are searched for.

Please see:
Tip: How Do I Get The Best Answer in the Shortest Time?

I don't know what that means. Did my macro make the changes, or not?

it worked fine for me when I ran it against a file containing this:

vl=1, vl=2, vl=3, vl=4, or vl=5

Hey @JMichaelTX,

I believe the OP is renaming files rather than altering file content.

-Chris

Could be, it is not clear:

@mftr, please clarify and provide us with real-world examples showing both before and after the change.