I am having trouble figuring out how to do a "chmod o-w" for all files under a certain directory, while excluding directories under that certain directory.
I can do
chmod -R o-w /thisdirectory
but that changes permissions of all directories under the directory as well as files. I just want files immediately under 'thisdirectory'... Thanks in advance.
find /thisdirectory -type f -exec chmod o-w '{}' ';'
to run it only on files.
If you're on a platform that supports the syntax, a minute change will make it run much faster by putting as many arguments into chmod at once as it safely allows:
find /thisdirectory -type f -exec chmod o-w '{}' '+'