I find it easier to use the special execute mode X (capital x).
chmod -R u=rwX,go= directory/
From Wikipedia:
Quote:
X (special execute) is not a permission in itself but rather can be used instead of x. It applies execute permissions to directories regardless of their current permissions and applies execute permissions to a file which already has at least 1 execute permission bit already set (either user, group or other).
|
So if you previously applied execute to all files, you'll first need to remove all rights:
sudo chmod -R 000 directory/
sudo chmod -R u=rwX,go= directory/
It's crucial to use sudo/root login, otherwise recursion will fail.