recursive chmod

Edward Glowacki glowack2@msu.edu
Mon, 27 Nov 2000 15:31:47 -0500 (EST)


On Mon, 27 Nov 2000, Benjamin Minshall wrote:
> Greetings:
> 
> I have a directory tree consisting of several thousand files and directories
> nested quite deeply in many places.  I need to change the permissions of all
> the files to 0644 and all of the directories to 0755.  I can't use chmod -R
> *  because it won't give files and directories different permissions.  Any
> suggestions?  Thanks.
> 
> -Ben

Yep, try this:

find / -type d -exec chmod 0755 {};
find / -type f -exec chmod 0644 {};

Where:

/ is the top-level directory you want to start from (in this case the root) 
{} is a placeholder for the filename/directory found
; terminates the "exec" expression  

You may have to escape some/all of the {}; characters if your shell
does stuff with them.  See the "find" manpage for more information.

Happy chmodding! ;)

-- 
Edward Glowacki			glowack2@msu.edu
Network Services		
Michigan State University