find and replace all files 644 folders 755

Using xargs:

find . -type d -print0 | xargs -0 chmod 0755
find . -type f -print0 | xargs -0 chmod 0644

Using for loop:
for i in `find . -type d`; do chmod 755 $i; done
for i in `find . -type f`; do chmod 644 $i; done

Or simply exec in one command:
find . \( -type d -exec chmod -v 755 ‘{}’ \; \) -o \( -type f -exec chmod -v 644 ‘{}’ \; \)

Leave a Reply

Your email address will not be published. Required fields are marked *