[plug] find -exec

Craig Ringer craig at postnewspapers.com.au
Tue Oct 25 13:09:11 WST 2005


Lyndon Maydwell wrote:
>>>find dir/ -type d | xargs chmod 755
>>>find dir/ -not -type d | xargs chmod 644
> 
> 
> didn't like funny filenames, solution:
> 
> find dir/ -not -type d -and -not -perm 0644 -print0 | xargs -0 chmod 644
> find dir/ -type d -and -not -perm 0755 -print0 | xargs -0 chmod 755

man chmod:

        The letters ‘rwxXstugo’ select the new  permissions  for  the
        affected users:  read  (r),  write (w), execute (or access for
        directories) (x), execute only if the file is a directory or
        already has execute  permission  for  some user (X)

amd thus:

chmod -R u=rwX,g=rX,o=rX dir/

`find' is great, but in this case there's an easier way, and one that'll 
be a fair whack faster.

--
Craig Ringer



More information about the plug mailing list