[plug] changing permissions through multiple directories

Leon Brooks leon at brooks.fdns.net
Tue May 21 16:51:21 WST 2002


On Tuesday 21 May 2002 15:36, Tim Bowden wrote:
> I have a directory tree that is several layers deep, with multiple files in
> each.  I need to change the permissions on all the files/ directories in
> one go.  how do i provide the arguments to chmod to do this?

chmod -R $ATTRIBUTES /path/to/top/dir

For example `chmod -R go-w,a+x .' makes the current directory and all below it 
unwriteable to all except the owner (ie, if it was writeable by the owner 
before the chmod, it still will be), and all exexcuteable by everyone 
(`executable' to a directory means that it can be scanned, readable means 
that files in it can be looked at: r-- means files can be opened in it if you 
know what their names are, --x means that you can see the names etc but not 
touch the files).

-R works with many commands.

Have you tried `man chmod' yet? (-:

To make all directories readable and listable, but all normal files 
non-executable:

    find . -type f -exec chmod a-x {} \;
    find . -type d -exec chmod a+rx {} \;

In case your enmail client eats it, there is a backslash before each ; above.

Cheers; Leon



More information about the plug mailing list