Folder Action Email Script

Hi,

I am looking to write a Folder Action to watch a folder on a server and email the time/date and Name of file that was uploaded via FTP. This action will be running on tha actual server.

Will it matter how the file is added? Are folder actions triggered by an actual drag in the finder or will an upload via ftp client be able to trigger the script?

My thoughts are I am going to have to setup a “Watch Folder” script and check it at repeating intervals.

Any help with this would be great. i know enough AS to look stupid. :lol: I am good at modifying written scripts to my benefit though.

Any help is appreciated.

Cheers, John.

Here’s an example that uses Eudora to send the messages. For each item (file or folder) that arrives in the watched folder, it will generate an email message and then send it. This is just a basic example that should be developed further (error checking and stuff like that). It doesn’t matter how the file/folder arrives in the watched folder.

on adding folder items to this_folder after receiving added_items
	
	set date_ to (current date) as text
	
	repeat with file_ in added_items
		set info_ to info for file_
		set name_ to name of info_
		
		tell application "Eudora"
			set nm to make new message at end of mailbox "Out"
			tell nm
				set field "to" to "Steve Jobs <stevej@apple.com>"
				set field "subject" to "File Info"
				set body to "File name: " & name_ & return & "Date received: " & date_
			end tell
			queue nm
		end tell
	end repeat
	
	tell application "Eudora" to connect with sending without checking
	
end adding folder items to

– Rob

I will give it a try.

Thanks again.

Cheers, John.