2

I tried to run this applescript:

tell application "Finder"
    duplicate POSIX file contents "/Users/xx/Desktop/xxxx/" to POSIX file "/USB/" with replacing
    delete POSIX file contents "/Users/felix/Desktop/xxxx/"
    empty trash
end tell

but every time an error message appears saying:

Invalid key form.

Andrea
  • 11,801
  • 17
  • 65
  • 72
Felix
  • 128
  • 1
  • 12

1 Answers1

0

You don't need to use contents. This should work.

tell application "Finder"
    set src to POSIX file "/Users/xx/Desktop/test.tmp"
    set dst to POSIX file "/USB/"
    duplicate src to dst with replacing
end tell
tsnorri
  • 1,966
  • 5
  • 21
  • 29
  • now when I run it, applescript editor throws up this message: Finder got an error: AppleEvent handler failed. – Felix May 04 '15 at 11:30
  • this one: duplicate src to dst with replacing – Felix May 04 '15 at 12:04
  • I did have some problems with the target being a symbolic link but didn't find a solution yet. I got a different error message, though. – tsnorri May 04 '15 at 12:44