Sunday, October 29, 2006

Recursive chmod

A little known specifier for chmod is X (ie. capital x). It is basically a smart excecutable bit setter. It will only set mode +x on a file if it is an excecutabe or a directory. Combined with the -R option, you can easily chmod a directory structure whilst keeping the standard permissions. For example, to set all sub-directories and excecutables to mode 755, but normal files to mode 644, try:

chmod -R go=rX path

0 Comments:

Post a Comment

<< Home