Issue
I was asked to make all the HTML files I own have these permissions: RW-RW-R-- (so 664 I believe, currently they are 644).
So I ran this:
$ chmod -R 664 *.html
And it only changed the html files that were in that folder (I went to a sub folder and checked permissions there, they did not change). I need to change all of the files I have so I ran this from the top level folder.
Is my command wrong? Is it some server setting? I believe I have done this before, but I can't get it to work now.
Solution
With the command:
chmod -R 664 *.html
The shell will expand the file paths given (*.html
) and operate just on those. That would be all html files in the current directory. It won't traverse directories unless you have one that matches that pattern, and in that case, everything under that folder would be changed.
To do what you want to do, you need to use find
:
find . -name "*.html" -exec chmod 664 {} \;
If the html files you want to change are only one or two levels down, you could do something like this:
chmod 664 *.html */*.html */*/*.html
etc. But find
would be the general solution.
Answered By - lurker Answer Checked By - Katrina (WPSolving Volunteer)