LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] CHMOD

[ILUG] CHMOD

Brian Foster blf at utvinternet.ie
Tue Jan 13 08:25:58 GMT 2009


  | Date: Mon Jan 12 22:27:08 GMT 2009
  | From: Cian Davis cian.davis at skynet.ie
  |
  | Kae Verens wrote:
  | > unfortunately, it's not so flexible that you could do something like:
  | >   chmod 666 * -R && chmod 777 */ -R
  |
  | I assume most people know this but....
  |
  |     find ./ -type f -exec chmod 666 {} \;
  |     chmod 777 */ -R
  |
  | Would do it (combine the 2 with && if you want)...

 do what?  neither suggestion seems too sensible, or at
 the very least, is not understood by someone (who could,
 of course, be me).

 assuming the hierarchy only contains dirs and plain files,
 the end result of both suggestions (Cian's 'find' + 'chmod',
 or Kae's two 'chmod's) is all plain files in the top dir are
 mode 666, and *everything*else* ("all" sub-dirs, *and* all
 plain files in those sub-dirs, recursively) is mode 777.
 (there's actually one collection of names in the top dir
 that is treated differently; this is left as an exercise
 to the reader.)

 I *think* what yer trying to do is set all dirs (top dir
 and all sub-dirs, recursively) to mode 777, and all plain
 files (in the top dir, and in all sub-dirs, recursively)
 to mode 666.  this can easily be done with find(1):

    find . -type d -print0  |  xargs -0 chmod 777
    find . -type f -print0  |  xargs -0 chmod 666

 also notice it's now (IM(H?)O) clear what's being done.

 if you don't want to set the top dir to mode 777 (just
 all sub-dirs, recursively), then may be the time to use
 the '*/' trick:

    find */ -type d -print0  |  xargs -0 chmod 777

 albeit that will miss one (rare?) category of sub-dir
 names (left as an exercise to the reader).

cheers!
	-blf-

-- 
"How many surrealists does it take to    |  Brian Foster
 change a lightbulb?  Three.  One calms  |  somewhere in south of France
 the warthog, and two fill the bathtub   |     Stop E$$o (ExxonMobil)!
 with brightly-coloured machine tools."  |       http://www.stopesso.com



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell