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

Re: Chmodding a whole directory tree



Thought <krowan@eecs.wsu.edu> writes:

> 
> How do I make a whole directory tree and it's files readable by everyone?
> I can't just chmod -R a+r dir because then they won't be able to cd to the
> directories, but I can't chmod -R a+rx dir because then all the files will
> be executable...  Is there a way to make the directories +x without making
> all the files +x?  Or better yet is there a way to copy the owner's
> permissions to the group and other's permissions?  Thanks
> 
> 

You might try something like this:

#! /bin/bash
for direc in `find . -type d` ; do
    chmod $direc a+rx
done

for file in `find . -type f` ; do
    chmod $file a+r
done


Graeme

-- 
| Graeme A Stewart, pgp public key  finger graeme@ariel.igeofcu.unam.mx	|
|  Key fingerprint =  AF C7 BF A4 52 D5 3C 3B  17 A5 62 43 DA 15 E8 97  |
|   "Keep a good head, and always carry a lightbulb."	Dylan		|


Reply to: