How to get a folder to delete a file after performing some function

Hello,
I need my script to act on a hot folder.
When a file is placed in the hot folder it will tell FIleMaker to Insert the file into a container field in a record. When that is complete it will delete the file from the hot folder.

The following is a learning exercise I was trialling to get my head around this. This one is in my ‘/Library/Scripts/Folder Action Scripts’ folder and folder actions are set to enabled for the folder ‘hot folder’ and this script is selected for this folder. in the folder actions dialogue.

The script places a file in the ‘duplicates’ folder ok and launches when a file is placed in the folder, however it does not delete the file from ‘hot folder’ at the end.

on adding folder items to this_folder after receiving added_items
tell application “Finder”
try
duplicate added_items to folder “duplicate” of desktop
end try
try
delete added_items of this_folder
end try
end tell
end adding folder items to

Any hints on my deletion command or also on the necessary FileMaker 14 commands would be appreciated.
Thanks,
Morgan

Hi.

Leaving off ‘of this_folder’ should do it, since ‘added_items’ is already a list of direct aliases to the items.

But in the context of your script, it would make more sense use ‘move’ instead of ‘duplicate’ and to leave out the ‘delete’ command altogether.

Hey thanks that worked a treat.
I like your move idea but I’m testing my ability to delete and I’ll need to do it after I insert the file into a filemaker record.
Cheers,
Morgan