Folder Action repeats indefinitely. How do I get it to run once?

Hey everyone,

Maybe I don't understand folder actions, but I created a very simple "Date Stamp" application in automator that uses Apple's "Rename Finder Items" to add the Modified Date to a filename. I then saved that as a Folder Action to a Backups folder, so that whenever I copy a file into that folder using drag and drop, a date stamp is added to the end of the filename.

It works like a charm. Then it works again, every 5 seconds or so, FOREVER.

Here's the applescript that runs on the folder:

on adding folder items to this_folder after receiving added_items
tell application "Macintosh HD:Users:stevo:Library:Workflows:Applications:Folder Actions:Date Stamp2.app"
open added_items
end tell
end adding folder items to

I thought the folder action only runs when NEW files are added, but mine seems to be running on anything ALREADY in the folder.

What am I missing? Any help would be appreciated.

2.53 GHz Intel Core 2 Duo MacBook Pro (15"), Mac OS X (10.5.6), 4 GB RAM

Posted on Feb 23, 2009 1:01 PM

Reply
3 replies

Feb 23, 2009 2:45 PM in response to V.K.

Hi there. It's pretty much as I described, a very simple, one action workflow. I will attempt to post a picture.

/Users/stevo/Desktop/Workflow.png

It's Rename Finder Items

Add Date or Time
Date/Time: Modified
Where: After name
Separator: Underscore
Format: Month Day Year
Separator: Dash
Use Leading Zeros: checked

I think the problem is that as soon as the item is renamed in the folder, that counts as a modification date change (or a "new item being added" and so it just re-runs on the "new" item.

This particular Action has never given me what I wanted. It doesn't accept variables, so I can't use it to add short user name as a suffix to a renamed file. Seems like Automator wants me to rename it and THEN move it to a folder, but in that case I can't get the folder to be watched and trigger the rename.

I believe I'm S.O.L. on this one, but if anyone has a solution, I'm all ears.

Feb 23, 2009 2:52 PM in response to EditDog

When you rename a file, it is considered "new", which will trigger the folder action (again). You really shouldn't do anything directly to items inside a folder with an "on adding folder items to" action attached. One workaround is to create a folder within your action folder (for example "Completed Date Stamps"), then have the folder action move the items to that folder and rename them there.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Folder Action repeats indefinitely. How do I get it to run once?

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