stupid question about chmod
hi there
i need to set the file permissions on a directory and all subdiretories and files. files should have 660 and directories 770. now here's the problem... how can i tell chmod to only apply it to directories/files recursively? thanks a lot! |
Re: stupid question about chmod
Quote:
Do you want it to apply recursively (to all subdirectories and files of a directory) or to only one specific directory? Recursively: chmod -R 660 directory (The -R option means recursively) To apply it to only one directory (without the subdirectories affected) apply the above without the option -R. |
Another way to go about it...
Since you've got two types of permissions, you're probably better off doing it in two commands. It's possible to do it all in one, but unnecessarily difficult (in my opinion). Anyway, find is your friend: Code:
find /path/to/top/directory -type f -exec chmod 660 {} \; Similarly, the second command finds only directories. It will match the directory given on the commandline and all its subdirectories. It will also perform a similar chmod but with a different set of permissions (770 as opposed to the 660 for files). |
Quote:
Forget my post above, it won't get you the desired result. Consider Dark_Helmet's solution (he's the guru here anyway...) |
hi
thanks for your replies! the way Dark_Helmet described worked perfectly - thanks for the detailed explanation (this will get handy in the future too). |
All times are GMT -5. The time now is 07:45 PM. |