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

Re: NO! chmod strikes!



On Tue, Jul 10, 2001 at 10:42:42PM -0400, Paul D. Smith wrote:
> %% Dave Sherohman <esper@sherohman.org> writes:
>   ds> On Mon, Jul 09, 2001 at 12:29:40PM -0400, Paul D. Smith wrote:
>   dc> find . -print0 | xargs -0 chmod r-owx

>   ds> while the find version will leave .foo/bar alone and change
>   ds> foo/.bar (it looks at each filename independently).
> 
> Not true at all; the find version will change _both_ .foo/bar _and_
> foo/.bar.
> 
> "find ." matches everything in the current directory and below,
> _including_ hidden files.

I stand corrected.  As written, the find command will change the
permissions on everything within the current directory, regardless
of name.  I wasn't paying attention and didn't notice that dc forgot to
include a filter on the filenames.  Changing it to:

find . -name .[^.] -print0 | xargs -0 chmod r-owx

would cause it to change foo/.bar but not .foo/bar (although .foo/
itself would be changed unless another clause were added to filter out
directories).

As for the OP's intent, it must not have been clear, as you think he
wanted to change the perms on all hidden objects (including the contents
of hidden directories) within the current directory and I (based on the
-R in his original chmod) believe that he wanted to change all hidden
objects (excluding non-hidden files within hidden directories) within
the current directory or its children.



Reply to: