Contact Menu

Recursive chmod Tricks

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
See note from commenter, below, about effect on files ↓

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 {} \;

, , , , , , , , , ,

No comments yet.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.