2 Answers
2

The first parameter to your recursive chmod is the directory itself. You removed x bit on the directory, making it not searchable any more (that's what the x bit does for a directory). Then the chmod program could no longer search inside that directory and you get the permissions errors. try the following instead.

set execute permission only if the file is a directory or already has execute permission for some user

So, the lowercase -x option first removes the executable status from all files (and directories, of course), then the uppercase +X option sets it back only for directories.

It has one minor drawback: it sets the executable status to all subdirectories, even to those that didn't have it set prior to the chmod invocation. If that's not what you want, just use Keith's find solution.