Folder action without folder actions


I have had trouble with folder actions in the past where they would trigger before a file has been completely copied. Recently somebody has asked me to write a script to deal with this. I have now written a script that will repeatedly check a folder and compare the list of file names and file sizes against the lists last time it checked and if the file size of a file has not changed then the script calls the process file handler.

This script is not a folder action script, do not attache it to a folder. Just double click on the script saved as a stay open application.

This would have been a good script for code exchange, as it is it highlights some of my weaknesses with understanding AppleScript and as a result is probably more complicated than it needs to be. However it appears to work, but I would like others to test and make fixes.

You will need to save the script as a stay open application, The code follows:

This can also be of use if you want to catch, say, any modification dates changing, if that’s of interest. I don’t think (could be wrong) that there are any folder actions that would trigger that.

  • Dan

Nice. I optimized it a bit (sort of…) and added some very basic notifications (you can disable them by setting debugMe to false):


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thanks Jonn,

Exactly the sort of rough corner removal I was looking for. Sometimes I get lost in the details of the problem I can miss the cleanup stage.

When I get a chance I’ll post it on my website with credits of course.


This looks like a great script. I’m trying to use this script with a very simple shell script code to print a file to a printer and then remove the file after it’s printed. I’m trying to figure out which variable I could use to figure out the path of the file that is ready to be processed and also the file name. Here’s an example of the script that I add to do my printing

set the_printer to “Xerox4525-CommPrint”
do shell script “lp "” & theFile & "" -d " & the_printer & “; rm "” & theFile & “"”

I need to know which variable I should put in for theFile.