applescript - Copy files from one location to another: access not allowed error message -


i'm making script replace folder in containers folder in home user's library. far, code below works fine. nothing wrong it. issue is, because moves files rather copy them, can run once. however, if try , change move copy, following error:

can’t set filepath replacing «class ects» of «class cfol» ((path me string) & "contents:resources:folder1"). access not allowed.

can tell me why , how fix it?

set filepath (get path home folder) & "library:containers:folder1" string tell application "finder" move entire contents of folder ((path me string) & "contents:resources:folder1") filepath replacing 

you cannot replace move copy, because finder's applescript dictionary says following copy command:

copy v : (not available yet) copy selected items clipboard (the finder must front application)

use duplicate command instead:

duplicate v : duplicate 1 or more object(s)
    duplicate specifier : object(s) duplicate
    [to location specifier] : new location object(s)
    [replacing boolean] : specifies whether or not replace items in destination have same name items being duplicated
    [routing suppressed boolean] : specifies whether or not autoroute items (default false). applies when copying system folder.
    [exact copy boolean] : specifies whether or not copy permissions/ownership is
    → specifier : duplicated object(s)

example:

set filepath (get path home folder) & "library:containers:folder1" string tell application "finder" duplicate entire contents of folder ((path me string) & "contents:resources:folder1") filepath replacing 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -