cp help

I am trying to use applescript to execute the unix command cp. i am trying to make it copy an application bundle inside the program’s resources folder to a location defined by the user in a choose folder dialog. i dont speak fluent unix, however, and cannot figure out how to do this. can anyone help me?

I would check out “man cp” and read all about the cp command, then do extensive testing on the command line. I would guess you’d want to use “cp -pr ”, to make it a recursive cp and to preserve permissions, since you mentioned copying an application bundle to a location of the users choosing.

Try this:

set theApp to quoted form of POSIX path of (path to resource "myApplication.app")
try
	choose folder with prompt "Copy application to this folder:" default location (path to applications folder) without invisibles
end try
do shell script "cp -Rp " & theApp & " " & quoted form of POSIX path of result

If you want to try using the Finder:

try
	choose folder with prompt "Copy application to this folder:" default location (path to applications folder) without invisibles
end try
tell application "Finder" to duplicate (path to resource "myApplication.app") to result

Model: Mac mini
AppleScript: 1.10
Browser: Safari 412
Operating System: Mac OS X (10.4)