I have a directory with many subdirectories and files in it, and I would like to change the permissions of the files there the following ways. Basically, I want to protect the directories better.
First, all DIRECTORIES should be just chmod to 750 recursively, but only directories.
For files: if a file has a +x for the main user, it should be changed to 750, otherwise it should be changed to 640 (meaning no +x, r/w for the main user, r for the group, no permissions for world).
This should be applied to all files in all directories.
Is there a way to do that?