How can I copy files quietly?

I have written a script to copy files from a location to another but want to suppress both the copy dialog and click noise that happens when each file is copied.

Can any one please give a pointer to how this can be done?

Thanks for your help.

Try this.


-- "cp" will copy the file and "mv" will move the file
-- no sound or dialog appears during operation

my transferFile("cp",  filePathFrom, filePathTo)

on transferFile(cp_or_mv, filePathFrom, filePathTo)
	set posixfilePathFrom to quoted form of (POSIX path of filePathFrom)
	set posixfilePathTo to quoted form of (POSIX path of filePathTo)
	do shell script cp_or_mv & " " & posixfilePathFrom & " " & posixfilePathTo
end transferFile

Works like a dream!

Thanks.

Back after a year or so as for some reason, this snippet doesn’t work any longer (I haven’t used it for a few months)

Any thing changed in Applescript with the OS Upgrades that have happened? I am on OS X 10.5.8

Thanks

Model: MacPro 2 x 2.8 Quad Zeon
AppleScript: 2.0.1
Browser: Safari 4.0.3
Operating System: Mac OS X (10.5)

Solved

I had to set the variables that went into “filePathFrom” and “filePathTo” as aliases first.

Dunno why as I had used it as it was before but doing this solved the issue.