From: "Ram Smith" <[EMAIL PROTECTED]>
Sent: Tuesday, August 12, 2003 11:32 AM
> G'day,
> 
> I'm looking for some pointers on how to do this scripting task.
> 
> I have a shared directory structure where alot of the files in each
> directory have permisions of 644 I wanting to change it so that the
> files are chmod 664 letting all users in the group read and write to the
> data. without nuking the permissions on the directories along with the
> files.
> 
> chmod -R won't work. There doesn't appear to be an option to
> exclude dirs with chmod.
> 
> how would you go about doing this.
> 

I create a script, chmod.sh:

#echo chmod.sh

 #!/bin/bash
 for i in `find $@ -print`      # list files and dirs
 do                                        # process each list
 if [ -d $i ]                            # if a directory 
 then chmod 644 $i             # then chmod to 644 or some other
 else                                      # not a directory
 chmod 700 $i                     # then chmod to 700 or some other
 fi                                          # end of listing
 done                                    #  terminate script

E.g.

#chmod.sh   /home/oscarp /appl /home/purl.org


Oscar Plameras
http://www.acay.com.au/~oscarp/disclaimer.html
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to