[Gllug] How to chmod selectively without writing a script

Tethys tet at accucard.com
Tue Oct 1 12:08:40 UTC 2002


>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