On 04/15/2014 12:43 PM, Richard Neill wrote:

> Typical use-cases:
> 
> (a) I have several nested directories of photos that originated from a 
> digital camera with a FAT filesystem. Therefore all the directories, 
> subdirectories and files are mode 777. I want to remove the executable 
> permission from the files, but not the directories.
> 
> =>     chmod -Ru  my/photos/
> 
> (alternative is some ugliness with "find -type d")

This has been suggested a few times (becoming a FAQ).

http://lists.gnu.org/archive/html/bug-coreutils/2010-02/msg00201.html
http://lists.gnu.org/archive/html/bug-coreutils/2011-05/msg00047.html
http://lists.gnu.org/archive/html/coreutils/2014-03/msg00063.html

So either the 'X' symbolic mode:
  info coreutils 'Symbolic Modes' 'Conditional Executability'
or using find ... as a filter was previously deemed sufficient.
Using find is less ugly IMHO as it's more cohesive/functional

  find my/photos \! -type d | xargs chmod a-x

Advantages:
  1. Works on all systems, so don't have to worry about forwards/backwards 
compat
  2. Single filtering syntax to learn
  3. Don't need to maintain logic in chmod

thanks,
Pádraig.

Reply via email to