[Gllug] How to chmod selectively without writing a script

Garry Heaton garry at heaton6.freeserve.co.uk
Tue Oct 1 15:07:45 UTC 2002


Thanks, Tet

Can you explain why

chmod -R 755 */

... changes files as well as directories. I couldn't find anything in
"Linux Desk Reference" (Scott Hawkins) to explain the "{} \" in the
solutions you offered. They work fine, of course, but I need to
understand what's going on.

Garry


> Message: 4
> To: gllug at linux.co.uk
> Subject: Re: [Gllug] How to chmod selectively without writing a script 
> Date: Tue, 01 Oct 2002 13:08:40 +0100
> From: Tethys <tet at accucard.com>
> Reply-To: gllug at linux.co.uk
> 
> 
> 
>>I want to be able to change the permissions on subdirectories without
>>changing the contents of those directories. So far I've tried
>>
>>chmod -R 755 */
>>
>>... but this changes all the files to 755.
> 
> 
> You want to use:
> 
> 	find . -type d -exec chmod 755 {} \;
> 
> 
>>This being the case, why does
>>
>>chmod -R 644 *
>>
>>... affect all subdirectory files while
>>
>>chmod -R 644 *.* only affects the current directory?
> 
> 
> Because of the way wildcard expansion is done. Under Unix, the shell
> expands wildcards before passing the list of file to the appropriate
> command. Thus, in your case, "*.*" will expand to the list of all
> files and directories in the current directory that contain a "."
> in their name. You probabvly don't have any directories with names
> containing a ".", so chmod will never see the ones you do have.
> 
> Tet
> 


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list