After I apply
chmod -R to a directory, permissions are changed for everything within (files and directories). How can I add execute/search (
x) permissions to directories without modifying the files?
In this particular case you can use
X instead of
x which only adds the bits to directories or files which already have the executable bit set for some user (i.e.
chmod -R +X my_dir).
In general (e.g. if you wanted to make all directories readable without affecting the files), you could either use
-type d or if you're using zsh (or bash 4 with
shopt -s globstar) the
**/ glob (both without passing the
-R flag to