detecting modified (not added) files?


I’m trying to automate the copying of files after they’re exported from Flash. The problem is that the files already exist. I’d like to be able to go straight from Flash to Safari, and see the resulting file, which assumes that once it’s been exported (overwriting the old one), it’s been copied into my Tomcat webapps folder… which so far hasn’t been working, since the Folder Actions “added_items” doesn’t get triggered on file updates, only additions.

Anyone familiar with a workaround?

Hi Michael,

maybe something thike this?

property theWatchedFolder : "Macintosh HD:Users:youruser:Desktop:yourfolder:etc"
property intervall : 0.5 * minutes 
property timeForSaving : 0.1 * minutes -- this value is experimental and depends on how fast your flash writes it's files

on idle
	set sinceDate to (current date) - intervall - timeForSaving
	tell application "Finder"
		set theNewFiles to every file of folder theWatchedFolder whose modification date is greater than sinceDate
		if (count of theNewFiles) > 0 then
			-- do something
		end if
	end tell
	return intervall
end idle

Hope it helps …


Thank you :slight_smile: that looks like it’ll be handy, and I can certainly make use of it.

Last night I thought about the problem a bit differently, realizing I didn’t really need the exported files to remain in the export folder, and that if I just modified the usual copy-added-files script to also delete after copying, I would have a workable solution (since the export would always be creating a new file from the POV of the finder).