How to Copy files to a Mounted Drive using AppleScript

applescript

In what way can I copy home folders (Documents, Pictures, Movies, etc…) to a mounted drive without using the POSIX function in AppleScript?

Best Answer

Finder

tell application "Finder"
    duplicate items of home to disk "WD" with exact copy
end tell

with exact copy preserves owner and group, like Paste Exactly.

cp

do shell script "cp -a ~/ /Volumes/WD"

cp -a is equivalent to cp -Rp. -p preserves times, mode, owner and group, extended attributes, ACLs, file flags, and resource forks.

rsync

do shell script "rsync -aE ~/ /Volumes/WD"

-E preserves extended attributes, ACLs, file flags, and resource forks.