Find All Directory or File (Recursively) Only And Execute Command (Chmod)

Dec 14, 2017

Apply chmod 755 to directory and sub-directories only (excluding files).

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

Apply chmod 644 to all files only (excluding directory).

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

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.