You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Automater rename issue

Greetings.

I'm trying to create a hot folder that renames any file that lands in it.


The set up seems fairly straightforward:


Rename Finder Items

Add Text

Add: _PRINT after name


Done.


But the result I'm getting is that the automater loops over and over and my file ends up with about 20 _PRINT's in the filename.


I've tried different variations of the workflow:


Replace Text

Find: .pdf

Replace: _PRINT.pdf


Done.


Yet the result is the same. The reason for this is that I'm using an InDesign script that will allow me to batch proof/print many files at once, but it doesn't allow suffix's. I know I could rename them with the finder, but I'm all for streamlining workflows.


Any guidance would be appreciated.


Mac Studio (2023)

Posted on Oct 24, 2024 1:28 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 24, 2024 8:14 AM

Barney already explained why this happens.


Another way around this is to do the folder action in a slightly different way.

Instead of renaming the file outright, first test if the name does not already contain "_PRINT", and only rename the file in case it does not already. This way, the first time a file is dropped into the folder, the script runs, renames the file; this causes the script to run a second time, but this one does nothing, and there is no more loop.

7 replies
Question marked as Top-ranking reply

Oct 24, 2024 8:14 AM in response to TheMaybz

Barney already explained why this happens.


Another way around this is to do the folder action in a slightly different way.

Instead of renaming the file outright, first test if the name does not already contain "_PRINT", and only rename the file in case it does not already. This way, the first time a file is dropped into the folder, the script runs, renames the file; this causes the script to run a second time, but this one does nothing, and there is no more loop.

Oct 24, 2024 5:57 AM in response to TheMaybz

An Automator folder action is triggered by a write operation in the designated folder. The act of dropping a file on that folder is one write operation. Renaming the file in the same folder is another write operation and that will trigger the Automator redundancy that you observe.


What you want is a write-once scenario and then move (rename) the file instance to another folder outside of the drop folder.

Oct 26, 2024 7:56 AM in response to TheMaybz

Just a quick note to tell you that I have not forgotten this.


I tested an Automator workflow, and it was working when run on its own, but somehow it was failing when used as intended, as a folder action. I will have to go back to it, and try to figure out why it is not working (I am thinking that some security restriction is getting in the way).


Alas, Automator itself does not offer a control flow feature like an "If ... then", so the solution I had in mind is to do this testing inside a script (using either an AppleScript or Shell script action).


I hope to report back with a working solution.

Oct 24, 2024 6:19 AM in response to VikingOSX

Thanks for this. I think I understand.


I created another folder level which the PDF is dropped into, the rename occurs then it moves out into the final folder. And it worked.


It's a shame I have to create an extra level of folder and the function doesn't work in the same way the finder rename does.


But thanks for the lesson and solution.

Automater rename issue

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.