coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wish: chmod -R to handle directories and files differently


From: Pádraig Brady
Subject: Re: wish: chmod -R to handle directories and files differently
Date: Tue, 15 Apr 2014 13:18:41 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

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

[Prev in Thread] Current Thread [Next in Thread]