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.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

rename files with automator

i create a workflow to rename my file with automator like this.I want to rename the file to append some words after the filename which i save in folder test2.

and the I save the workflow and try it .it act like this

seems the automator try to rename the file in a while(true) loop.

what should I do

MacBook Pro 13″, macOS 11.2

Posted on Apr 11, 2021 10:49 PM

Reply
Question marked as Top-ranking reply

Posted on Apr 12, 2021 9:48 AM

Is your workflow a folder action, set to rename any file added to the folder?


If so that's your problem. It goes like this:


  1. File added to folder
  2. Folder Action kicks off
  3. File is renamed


at this point, the renamed file looks like a new file added to the folder, so the folder action kicks off again... .and again...


The way around this is you need to check if the incoming file has already been renamed.


The easiest way to do this is to add a 'Filter Finder Items step at the beginning of your script to filter out any filenames that contain _test. In this way these files will not get re-renamed and trigger the script again.

Similar questions

4 replies
Question marked as Top-ranking reply

Apr 12, 2021 9:48 AM in response to yijinsheng

Is your workflow a folder action, set to rename any file added to the folder?


If so that's your problem. It goes like this:


  1. File added to folder
  2. Folder Action kicks off
  3. File is renamed


at this point, the renamed file looks like a new file added to the folder, so the folder action kicks off again... .and again...


The way around this is you need to check if the incoming file has already been renamed.


The easiest way to do this is to add a 'Filter Finder Items step at the beginning of your script to filter out any filenames that contain _test. In this way these files will not get re-renamed and trigger the script again.

rename files with automator

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