Recursive Chmod Tricks

by damonp on June 27, 2007

Recursively chmod only directories

find . -type d -exec chmod 755 {} \;

Similarly, recursively set the execute bit on every directory

chmod -R a+X *

The +X flag sets the execute bit on directories only

Recursively chmod only files

find . -type f -exec chmod 644 {} \;

Recursively chmod only PHP files (with extension .php)

find . -type f -name '*.php' -exec chmod 644 {} \;

Popularity: 80% [?]

{ 3 comments… read them below or add one }

ing_uu_mm December 18, 2009 at 1:28 pm

saved my day. thanks a lot

Reply

girl_on_fly December 23, 2009 at 7:07 am

Awesome! Thank you!

Reply

me March 15, 2010 at 11:22 pm

Thanks!

Reply

Leave a Comment

Previous post:

Next post: