Re: Applying permissions to all files in all subfolders
Re: Applying permissions to all files in all subfolders
- Subject: Re: Applying permissions to all files in all subfolders
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 15 Aug 2007 12:12:57 -0400
> This is where "do shell script" SCREAMS out to be used.
I wouldn't say that. Obviously a "chmod -R" is a single line instead
of three, but I don't know if it's any more efficient than setting the
perms of the entire contents with the Finder. In any case, you still
have the same problem of needing to trigger the chmod when something
is dropped into a subfolder, and avoiding a chmod -R from the top
folder every time.
Also, you have to make sure that you set the execute bit appropriately
for directories, which complicates things. It works out to something
like
find $folder -type d -exec chmod 0775 {} \; -o ! -type d -exec chmod 0664 {} \;
which isn't terribly efficient what with the one-exec-per-file ratio,
so you might split it into two find commands using xargs:
find $folder -type d -print0 | xargs -0 chmod 0775
find $folder ! -type d -print0 | xargs -0 chmod 0664
You could also replace the numeric mode values with symbolic ones,
which are allegedly more readable: 0775 becomes "ug=rwx,o=rx" (User
and Group have Read, Write, and eXecute; Other has Read and eXecute)
while 0664 becomes "ug=rw,o=r".
--
Mark J. Reed <email@hidden>
_______________________________________________
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