[CLUE-Tech] bash - find, xargs, chmod

Lynn Danielson lynn.danielson at clue.denver.co.us
Thu Nov 21 20:43:40 MST 2002


On Thu, 2002-11-21 at 16:45, David Willson wrote:
> OK, I have a large sub-tree of stuph.  I want the directories set as
> 2770 (rwx and setgid), and the files set as 2660 (rw and setgid).  So I
> launch the following commands:
>  find -type d | xargs -i chmod 2770 {}
>  find -type f | xargs -i chmod 2660 {}
> 
> both lines fail with something like "unmatched single-quote" and sure
> enough, there are folders with names like "CD's" and files with names
> like "Directions to David's house".
> But I am concerned about making all the files executable...
> 
> What's the answer?  Anyone?

I have the same problem when using xargs, but not if I use
the -exec switch with find, i.e.,

find -type d -exec chmod 2770 {} \;

'Frustrating that this should work and xargs doesn't.  I tried
quoting the the default argument operator "{}" with no success.
Getting rid of the the -i and {} didn't help either.  It still
failed on the unmatched single quote.  But find's exec handled
it fine.

Fwiw,

Lynn




More information about the clue-tech mailing list