I am quite stuck on this problem.
I am creating a script that will copy a user's home directory to new user's home directory. I have almost got it working, except that I need to change the owner of the new user's home directory temporarily, so that the script can copy the files, and then change the owner back after the copy is done.
I've come up with the following:
do shell script "echo " & Pass & " | sudo chown -R " & uID & ":" & uID & " /Users/" & uID password Pass with administrator privileges
where Pass and uID are variables containing the admin password and short name of the new user respectively.
Everything looks like it should work with no problems. However, when the password contains an odd character (in my case, the odd character is an exclamation mark), the statement will fail, because I believe that the exclamation mark is some kind of reserved character.
Is there a way to pass a password that may contain odd characters to this statement?
Alternatively, is there another way to do this in Applescript, using the Finder perhaps?
Many thanks for the help!
Terry Sheltra, Public Mac Support Technician University of Virginia School of Architecture |