which function to use when there already exist a file in the folder

hi, i am new to applescript.

Now i am trying to write a simple Folder Action script that would copy a file to another folder.
My code work only if there is no file with the same name exists in folder. If there is already a file with the same file name, and when i replace it , the script doesn’t kick off.

Of course i can move the file, but i want to keep all the original file in the primary folder.
Any function like “on replacing folder items…”

===========================================
on adding folder items to this_folder after receiving these_items
tell application “Finder”
set this_name to the name of this_folder
repeat with x in these_items
set this_file_name to x as text
duplicate file this_file_name to folder “Backup:Done:” with replacing
end repeat
end tell
end adding folder items to

tks and rgd

Hi,

what’s about placing a folder (I called it “Saved_Items” below) into the hot folder and move the items to keep there

on adding folder items to this_folder after receiving these_items
	tell application "Finder"
		duplicate these_items to folder ((this_folder as Unicode text) & "Saved_Items") with replacing
		move these_items to folder "Backup:Done:" with replacing
	end tell
end adding folder items to

hmm, good idea also… tks alot…:slight_smile: