duplicates - How do you look for and copy files if they exist in other profiles with applescript? -


i trying create applescript in each users profile crash logs in ~/library/logs/diagnosticreports .. use * @ end because there .crash .spin .hang files , need copy them current desktop folder "test" not sure if proper way it.

when try , run

error "can’t make \"test.txt\" type integer." number -1700 "test.txt" integer

try     shell script "ls /users >$home/desktop/users.txt"     shell script "mkdir ~/desktop/test" end try  set b boot volume of (system info) set u b & "users"  set thefiles paragraphs of "test.txt"    repeat thefiles times duplicate file u & thefiles & "~/library/logs/diagnosticreports/xxxxx*" "~/desktop/test"  end repeat 

thanks helping.

just use shell script:

do shell script "mkdir -p ~/desktop/test cp /users/*/library/logs/diagnosticreports/* ~/desktop/test" administrator privileges 

or loop through folders of (path users folder):

tell application "finder"     if exists folder "test" of desktop         set d folder "test" of desktop     else         set d make new folder @ desktop properties {name:"test"}     end if     repeat f in (get folders of (path users folder))         tell contents of f             if exists folder "diagnosticreports" of folder "logs" of folder "library"                 duplicate items of folder "diagnosticreports" of folder "logs" of folder "library" d             end if         end tell     end repeat end tell 

if don't have permissions read files of other users, can run finder root launchctl unload /system/library/launchagents/com.apple.finder.plist; sudo /system/library/coreservices/finder.app/contents/macos/finder.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -