Folder Action to rename files with sequential serial number

I’m in the intial stages of designing a group of folder actions to rename files that are dropped into the respective folders.

The script will rename files using a sequential serial number (so a duplicate name will never be created). Since this number needs to be persistantly updated each time the folder action fires, I think that a property that gets incremented should do the trick.

My question is would this be a safe way to do this or should I consider creating a “preference” text file to hold this (important) setting. The script would open the text file, increment to serial value as many times as it needs (for as many files have been dropped into the folder), update the value in the preference (text) file, then close and save the file. It seems cumbersome, but perhaps more reliable?

Another question I had about properties involves how a property will be handled if files are going into the folder action folder simultaneously. The folder action folder is going to reside on a file server that many users will have access to, so potentially 2 or more users may add files at (almost) the same time. Will this cause 2 separate instances of the folder action to fire? How will the property get updated in this case? I ask because I want the folder action to return the original names of the files and the new names of the files to a Filemaker database in the user’s frontmost record. I guess I’m concerned with how a folder action will handle this posssibility.

Thanks for any thoughts on this. Please don’t give me a script for this, I’m a newbie and I want to try to figure the script out for myself. I’ll post what I come up with once I get down to writing it.

Thanks again

I suggest that if you want to be sure that the property’s value is retained, write it to a file. If you rely on the script to store the property, you run the risk of losing it if the script is recompiled.

I don’t know how folder actions behave when items arrive during execution on other items. Someone recently reported that this caused problems for them. I guess you’ll need to do some testing to be sure. Good luck!

– Rob

Thanks for your input, Rob. I was afraid of that. Unfortunately, this script will be somewhat of a mission critical application; the numbers must never repeat.

It seems that many people don’t trust folder actions. I think I might try it as a folder action just to satisfy my curiousity about “simultaneous input”, but I think in the end this will have to be a droplet

Thanks again