Folder-Trigger Macro Successfully Renames a File Throws An Error

I'm testing a simple "search/replace text in a filename" Macro when a file with a key term is added to a watch folder.

It works when I add a file into the watch folder. But it also kicks up this error:
File action failed because destination already exists /Users/edw/Dropbox/My Mac (wispy-m.local)/Desktop/km test folder/this is a (deleted) file.txt in macro “rename files in watch folder” (while executing Move or Rename File “%TriggerValue%”).

At first I thought it was because I kept copying the same test file into the watch folder, and maybe it was renaming it to an existing file, but it does this even if the test file is the only file there.

Again, it is working. If I add a file named this is a test file.txt to the folder, it does get renamed into this is a (deleted) file.txt

Can someone tell me what I'm doing wrong?

rename files in watch folder Macro (v10.0.2)

rename files in watch folder.kmmacros (3.3 KB)

Hey @edjusted,

What error?

And please post actual testable macros, so people don't have to reinvent the wheel to test your work.

If we're not testing we're guessing – and guessing often leads to time lost.

How to Post Your Macro to the Forum

If you haven't read this it's worth a couple of minutes of your time.

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

Take Care,
Chris

(Keyboard Maestro Moderator)

Thanks! I reuploaded the macro properly and added the actual error message.

1 Like

Hmm...I just experimented a bit...

If I change the "search and replace" search term from "test" to something else, it works without the error message (i.e. the problem is gone).

Is "test" some sort of keyword?

Nyet.

You were testing against your whole path, and the folder name in the folder-trigger path contains “test”.

-Chris


Rename Files in Watch Folder v.1.00.ccs.kmmacros (3.4 KB)
Keyboard Maestro Export

But of course! :man_facepalming:t2:

1 Like

Those kinds of issues can be real head-scratchers – except in hindsight of course...

:sunglasses:

1 Like