Wednesday, April 27, 2022

[SOLVED] How to chmod all files in sub-directories without chmod the folders?

Issue

I have tried to chmod 444 for every HTML file in all sub-directories, but all files and folders were changed to 444 when I tried this command:

chmod -R 444 /home/ppp/ *.html

I just want to chmod all HTML files in /home/ppp folder and sub-folders, but not for folders and other file types.


Solution

Use this command :

find /home/ppp -type f -exec chmod 444 {} \;


Answered By - mbieren
Answer Checked By - Clifford M. (WPSolving Volunteer)