Syncing two folders

How do I go about asking a subfolder to periodically check a parent folder and if files are not in the parent folder to delete the copy from the subfolder. The files will be images, jpg, and will have identical names but will be different sizes as the subfolder is a thumbnail.
Ideally I like to attach this as a Folder Action Script at point of folder creation.

Thanks.

Hi. You are just deleting files that don’t have a named partner? You could use a folder action to invoke (semi-reliable) or use Cronnix to schedule this:

tell application "Finder" to ¬
	tell folder "mainFolderPath"'s folder "subFolderName" to ¬
		delete (files whose name is not in (get its container's files's name))

Thank you Marc, I will have a better look at this this evening when I have more time. I will also have to look up Cronnix as I don’t know what that is.