Copy a folder to a new directory.

I recently switched to Mac and am now working on a backup script. I work with 10 programming languages and now have to shift to the Mac side.

Can someone give me a quick example script that would copy a folder to a new location? Something similar to the following?

copy /Volumes/OS X/Scripts /Volumes/Backup/Scripts

Something like this. You can also include an absolute file path to the folder to be moved. In AppleScript syntax, “/Volumes/OS X/Scripts” would just be “path to scripts folder” which returns “YourVolumeName:Users:YourUserName:Library:Scripts:” Note the trailing “:” which like a trailing “/” signifies a directory (called a folder).

tell application "Finder"
	set myFldr to (choose folder) as alias
	set myDest to (path to documents folder) as alias
	duplicate myFldr to myDest without replacing -- or with replacing, if that's what you intend. It will overwrite the old.
end tell

Works like a charm. Thank you!