Re: Adding File Permissions Change
Re: Adding File Permissions Change
- Subject: Re: Adding File Permissions Change
- From: Philip Aker <email@hidden>
- Date: Fri, 31 Oct 2008 04:08:18 -0700
On 2008-10-30, at 15:30:17, Tom Thompson wrote:
I have a script that I use to move items from one folder to another
that works great. Occasionally a file does not have the proper
permissions though. How can I add to this applescript to change the
file permissions on the file being copied to read/write for all?
This can get very complicated. You usually have to set both the owner
and group of a file to an appropriate level. But sometimes it's the
permissions on the file and sometimes the permissions on its
containing folder. In addition, you have to know in advance the names
of a user and group with such privileges to apply the script with
administrator privileges!
One common shell command for modifying file permissions can be used as
follows:
set ppath to POSIX path of some_alias
do shell script "chown user:group " & quoted form of ppath with
administrator privileges
To change the permissions for a folder recursively it's:
do shell script "chown -R user:group " & quoted form of ppath with
administrator privileges
Assuming the user 'tom' has administrator privileges, the 'user:group'
specification in the above calls would be 'tom:admin'.
Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________
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