Is there a way to recursively change the access rights of a specific folder to 755 and files to 644 Without using the find function and having sub-directories in that folder (don't want to change those) ?

Currently I'm using chmod 755 -r folderName/

using find I think its something like that :

find /specific_folder/ -type f -print | xargs chmod 644
link|improve this question
feedback

migrated from stackoverflow.com Jun 29 '11 at 13:08

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 3 down vote accepted

You can do it this way:

chmod -R a=rX,u+w folderName

For CentOs the command is:

chmod -R a=rx,u+w folderName

But it will rewrite subdirectory permissions. As the consequence: you cannot do what you want with just chmod.

link|improve this answer
will that only work on files ? what about sub-directories .. i dont want to change their permissions – Tarek Jun 29 '11 at 11:30
yes, it does work for sub-directories as well. – akond Jun 29 '11 at 11:32
just tried that and it doesn't work – Tarek Jun 29 '11 at 11:43
You mean doesn't work at all or what? – akond Jun 29 '11 at 11:45
yes it doesn't work at all – Tarek Jun 29 '11 at 11:52
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.