You are here: Home / Journal / Setting file and directory properties separately and recursively

Setting file and directory properties separately and recursively

Sometimes in GNU/Linux one needs to set file and directory permissions separately and recursively. This is a way to do it.

Set file permissions:-

find . -type f -print0 | xargs -0 chmod 644 ;

Set directory permissions-

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

Note these are powerful commands with which you can do great harm. So please use with care.