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

Dennis J Perkins djperkins at americanisp.net
Thu Nov 21 22:41:22 MST 2002


Lynn Danielson wrote:
> 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
> 
> _______________________________________________
> CLUE-Tech mailing list
> CLUE-Tech at clue.denver.co.us
> http://clue.denver.co.us/mailman/listinfo/clue-tech
> 
> 

That's odd.  It works on my computer.  I wasn't aware, however, that if 
I left out the starting directory, that find would use the current 
directory.




More information about the clue-tech mailing list