[NBLUG/talk] chmod question

Ross Thomas spamb8r at netscape.net
Thu Oct 9 12:53:01 PDT 2003


Bob Blick wrote:
> Ross Thomas said:
> 
>>>  chmod -x `find . -type f`
> 
>> For small numbers of files.
>> Also, only files.
>>
>> This would be more appropriate:
>>     find . ! -type d -print0 | xargs -0 chmod -x
> 
> Excellent. Thank you. I had the problem of too many files for backticks to
> work some time ago, I guess it's time for me to get more friendly with
> xargs.

Two minor changes:
  1) You may need to 'escape' the '!' as in '\!' since the more modern
     Bourne shells and all the csh's use the '!' character for command
     history access; and

  2) It should use '-xtype' rather than '-type'.
     This stops the situation where a symlink to a dir is mistakenly
     'found'.  By saying -xtype, the type of the referenced object is
     checked rather than the actual symlink itself.  A subtle, but
     important distinction.  :-)

HTH

Ross.




More information about the talk mailing list