[svlug] How do I recursively chmod 0664 files but not directories?

Bill Kendrick nbs at sonic.net
Thu Jul 14 12:21:03 PDT 2005


On Thu, Jul 14, 2005 at 12:06:38PM -0700, Daevid Vincent wrote:
> I accidentally typed "chmod -R 0775 /mydir", so now all directories AND
> files are +x
> 
> What magical bash incantation can I type to recursively go through and make
> all files 0664 but make directories 0775?

X (capital X, versus lowercase) might be of use here.  Never had to
_undo_ the recursive chmodding like this, though.

A "find -type f" (for file) might be a good thing to try, too...

  find -type f -exec chmod 664 {} \;

-- 
-bill!                          Picn*x14 --- Linux Anniversary Picnic & BBQ!
bill at newbreedsoftware.com       Sunnyvale Baylands Park, Sunday, August 14th
http://newbreedsoftware.com/    http://linuxpicnic.org/ to RSVP & volunteer!




More information about the svlug mailing list