-1

I know I should assign a group and then set an umask so that groups writable permissions persist but for whatever reason I can't do this. I need to chmod recursively a directory except one sub folder (web10), would the following work?

cd /var/www/clients/
find . -type f -not -path "*web10*" -exec chmod 777 '{}' \;
Ross Knight
  • 9
  • 1
  • 5
  • 1
    This question is better suited for the [UNIX & Linux](http://unix.stackexchange.com) StackExchange site – Bert Feb 18 '13 at 21:15

1 Answers1

1

If you want to exclude files or directories, you use -prune

find /var/www/clients/ -name web10 -type d -prune -o -type f -print0 | xargs -0 chmod 0640

You should also use xargs where possible. With -exec you call the command once for every file found, whereas xargs collects as many files as possible and calls the command once for N files, resulting in a more efficient execution and better performance.

Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198