Nick Balistreri Nick Balistreri - 1 year ago 98
AppleScript Question

Moving contents: Can't get entire contents of path

I am simply trying to move the contents of my path from one directory to another but I keep getting an error and I am not sure what I am doing wrong. Any help would be greatly appreciated.

tell application "Finder"
set srcPath to POSIX path of ((parent of (path to me) as text) & "M Templates")
set dstPath to POSIX path of (((path to movies folder) as text) & "M Templates")


duplicate entire contents of srcPath to dstPath
end tell

foo foo
Answer Source

Assuming ~/Movies/M Templates already exists, and you want to copy additional files into it rather than just replace it completely:

set src to path to me
set dst to path to movies folder

tell application "Finder"
  duplicate items of folder "M Templates" of parent of src ¬
      to folder "M Templates" of dst with replacing
end tell

(Use duplicate...with replacing if you want Finder to overwrite any existing items automatically.)

Or, to copy the M Templates folder over, replacing any previous one:

set src to path to me
set dst to path to movies folder

tell application "Finder"
  duplicate folder "M Templates" of parent of src to dst with replacing
end tell
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download