• 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
Re: Applying permissions to all files in all subfolders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Applying permissions to all files in all subfolders
      • From: "John C. Welch" <email@hidden>
References: 
 >Re: Applying permissions to all files in all subfolders (From: Tom Giles <email@hidden>)
 >Re: Applying permissions to all files in all subfolders (From: "John C. Welch" <email@hidden>)

  • Prev by Date: Re: Applying permissions to all files in all subfolders with chmod
  • Next by Date: Re: AS for moving mails to local disk
  • Previous by thread: Re: Applying permissions to all files in all subfolders
  • Next by thread: Re: Applying permissions to all files in all subfolders
  • Index(es):
    • Date
    • Thread