[plug] find -exec

Cameron Patrick cameron at patrick.wattle.id.au
Mon Oct 24 23:28:00 WST 2005


Lyndon Maydwell wrote:

> find dir/ -exec if [[ -d {} ]] ; then chmod 755 {} ; else chmod 644 {} ; fi \;

> Suggestions?

You can't do anything that fancy with find -exec.  Write a shell
script that has your logic in it and call that from find.

Alternatively:

        find dir/ -type d | xargs chmod 755
        find dir/ -not -type d | xargs chmod 644

Cameron





More information about the plug mailing list