watching a folder on the server

I activated the folder action provided by apple (modified to send an email) on the Drop Box inside the Public folder of my account on a file server (Mac OS X 10.2.6).

If I am logged in at the server it works. If not, it does not.

Here is the code. Thanks for help, David

on adding folder items to this_folder after receiving added_items
– find out how many new items have been placed in the folder
set the item_count to the number of items in the added_items

	-- determine phrase at plural or singular
	if the item_count is greater than 1 then
		set theDropped to (the item_count as text) & " new items"
		set theDropped to "One new item"
	end if
	set theSubject to theDropped & " in your dropFolder"
	set messageBody to "DropFolder Notification" & return & return
	set messageBody to messageBody & theDropped & " in the dropFolder" & return & return
	repeat with currentItem in added_items
		set messageBody to messageBody & "   - " & currentItem & return
	end repeat
	set mailCommand to "echo " & messageBody & " | mail -s dropFolder dz"
	do shell script mailCommand
end try

end adding folder items to

Let me start by saying that I’ve never attempted to use a folder action on a server. I can see where it might cause problems or it might even be impossible.

You might want to consider a stay open application (script) that monitors this folder. It could check every x seconds to see if the server is mounted and then, if it is, proceed with the rest of the script. If you decide to go this route, the script could be added to the Login Items (in System Preferences) and it could be configured so that the icon doesn’t show up in the dock when it’s running.

– Rob

Thanks. I had never used a folder action on a server either and from what I have been able to find out it is probably not a good idea.