• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Changing ownership of a folder and all contents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing ownership of a folder and all contents


  • Subject: Changing ownership of a folder and all contents
  • From: Terry Sheltra <email@hidden>
  • Date: Thu, 16 Aug 2007 11:06:03 -0400

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
w:434.982.3047     e:email@hidden


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Changing ownership of a folder and all contents
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: Name comparison taking a long time
  • Next by Date: Re: Name comparison taking a long time
  • Previous by thread: Re: Name comparison taking a long time
  • Next by thread: Re: Changing ownership of a folder and all contents
  • Index(es):
    • Date
    • Thread