Hi, im new to this forum, sorry if these seems real obvious but im not a scripter im an open/active directory specialist.
I have some preference files i want to copy from where i currently have them. (on the root of the hard drive, so /preferences)
and copy them to a users folder of a user that is about to login (this will be used as a login script through osx server) . so copying to ~/libary/preferences
I havent a clue how to script this copying procedure, so could someone be able to right a quick script for me?
Well i think i have now figured out the copy bit. however i dont know how to script the path. i need to copy it to the user that is logging in, so ~/library/preferences folder. but if i do that it doesnt like it. Obviously i could do Mac HD:Users:john(name of user):Library:Preferences
But if i do that it would only copy it to a user called john. i need it to copy it to whatever user is logging in at the time.
so for the current users folder i can use home but what if i want a path within the home folder, such as library/preferences? how do i script that? HELP!!?!!
set user_lib_prefs to path to preferences folder -- result is an alias to the prefs folder of current user
set lib_prefs to path to preferences folder from local domain -- result is an alias to the prefs folder of /Library
to move a file to /Library you can use:
tell application "Finder"
move yourFile to lib_prefs
end tell
but note, that on the same volume the file will be only moved, not copied.
If you want to copy the file, use:
tell application "Finder"
duplicate yourFile to lib_prefs
end tell
if the file should replace an existing file at this location, write:
tell application "Finder"
duplicate yourFile to lib_prefs replacing yes
end tell