I want to change the permissions on directories, recursively to:
drwxr-xr-x
but keep the files within the directory tree as:
-rw-r--r--
But I can't find an option for chmod to only affect directories. I suppose it won't hurt (in this case) to set the x for the files, but I want some consistancy.
Robert Moskowitz wrote:
I want to change the permissions on directories, recursively to:
drwxr-xr-x
but keep the files within the directory tree as:
-rw-r--r--
But I can't find an option for chmod to only affect directories. I suppose it won't hurt (in this case) to set the x for the files, but I want some consistancy.
find <path> -type d -exec chmod 755 {} ;
nate
On Mon, Dec 01, 2008, Robert Moskowitz wrote:
I want to change the permissions on directories, recursively to:
drwxr-xr-x
but keep the files within the directory tree as:
-rw-r--r--
But I can't find an option for chmod to only affect directories. I suppose it won't hurt (in this case) to set the x for the files, but I want some consistancy.
find . -type d | xargs chmod 755
Or if the directories may have whitespace
find . -type d -print0 | xargs -0 chmod 755
Bill
Bill Campbell wrote:
On Mon, Dec 01, 2008, Robert Moskowitz wrote:
I want to change the permissions on directories, recursively to:
drwxr-xr-x
but keep the files within the directory tree as:
-rw-r--r--
But I can't find an option for chmod to only affect directories. I suppose it won't hurt (in this case) to set the x for the files, but I want some consistancy.
find . -type d | xargs chmod 755
Thanks. Worked like a charm....
Hi,
On Mon, Dec 1, 2008 at 12:53, Robert Moskowitz rgm@htt-consult.com wrote:
I want to change the permissions on directories, recursively to: drwxr-xr-x
but keep the files within the directory tree as: -rw-r--r--
But I can't find an option for chmod to only affect directories. I suppose it won't hurt (in this case) to set the x for the files, but I want some consistancy.
You can use chmod +X, it will work if your files are already not executable. +X will keep the executable bit for the ones that already executable (directories) but not set it for who doesn't have it.
You can use something like: chmod -R a+rX,u+w,go-w .
Of course, if your files have the executable bit set and you want to remove it, it won't work for you, in that case you should use the find | xargs chmod solution that was posted already.
HTH, Filipe