"Fire and forget" to copy files


I know how to script a file copy (copy ‘fileToBeMoved’ to ‘newfolder’) but I have two problems with it:

1- I wish to copy a huge file and this may take a while. Therefore, I would like to initate the copy but close the script prior to the end of the copy (usually, the scripts waits for the end of the copy to close and takes unnecessary resources).

2- I would like to replace my file (not only copy it) and would prefer not to have to answer the “do you want to replace this file?” question : any way to bypass this security ?

Many thanks in advance for any help !


Actually, the command’s ‘duplicate’, not ‘copy’.

I think this does what you need, but I don’t currently have a large enough file to test it properly.

ignoring application responses -- Don't wait for the Finder to report back.
	tell application "Finder"
		duplicate fieToBeMoved to newFolder with replacing
	end tell
end ignoring