Document Actions
chmod only directories, or specific files, recursively.
I keep forgetting the exact syntax of this command, so thought I would post it to myself (and anyone who could benefit from it) here, where Iknow I can find it anywhere.
to chmod just directories, recursively:
find ./ type d -exec chmod 755 {} \;
To chmod just files recursively (all):
find ./ type f -exec chmod 644 {} \;
To chmod just directories (or files, just change "-type d" to -type f")with a specific string match:
find , -type d -name '*bin*' -exec chmod 755 {} \;
find . -type f -name '*.htm*' -exec chmod 640 {} \;
On a barely related note, to get a cound of files in a directory (recursively):
ls -1R | wc -l
Enjoy!
- Category(s)
-
Nix
-
Technology
- The URL to Trackback this entry is:
- http://www.hawkes-haven.com/blahg/chmod-only-directories-or-specific-files-recursively/tbping

