Move and Rename a File by Appending to the Variable Name

Move and Rename a File using variable

Move- Copy- or Trash a File.kmactions (499 B)

Keyboard Maestro Export

This should be fairly straight forward but I'm not getting the desired results. I want to append a filename contained within a variable with additional text when its moved to another location.

In my experimental macro I've tried this among other things in the to field:

 /Volumes/ATOM G-T3/Processing/Processed/%TriggerValue%_Complete

But the resulting filename is literally %TriggerValue%_Complete :laughing:

So how can I append OR even prefix a filename contained within a variable?
Hoping I shouldn't have to place the desired appended text into a variable and concatenate it.

Btw, I did search the forum before asking this but I only found examples using iteration containers and I couldn't translate them to a more simplified task as I'm looking to do.

Without seeing your complete macro and therefore where %TriggerValue% comes from it's impossible to say for sure what's happening. Please post your macro.

Of course. Sorry, I thought the isolated macro would have sufficed and didn't want to overkill the question. Here you go. The if then else section is the one I created and am attempting to get working

Bounce and Process Audio File Ver. 3 Macro (v10.2)

Bounce and Process Audio File Ver. 3.kmmacros (51 KB)

No problem.

Since you're using folder-change trigger for your macro, %TriggerValue% will contain the full path of the file that was added to the folder.

Therefore you'll want to split out the filename and extension using the Split Path action and then you can do what you like. As an example, like this:

Note: you, of course, would have %TriggerValue% where I've got an actual path.

You can then rename the file as you wish. E.g.


Perfect, that did it! TY!

1 Like

That's not a macro it's an isolated action.

Macros contain many moving parts, and some of them are hidden. Sometimes those hidden bits are the key(s) to troubleshooting a problem.

So... It's generally best to post the simplest possible test macro that demonstrates the problem you're having, and when possible a macro that doesn't require specialized software to run.

The easier you make it for others to test your work the more likely you'll get timely and useful assistance.

It's a good practice to test and eyeball a benign result when working with shell scripts and things like KM's move, copy, and anything else that requires a path.

Download: Folder Trigger ⇢ Test.kmmacros (3.0 KB)
Keyboard Maestro Export

I've debugged more than a few problems and prevented quite a few disasters by following my own advice.

You should also have a kill-switch if you don't already: