How to change the permissions the whole directory?
Hi,
I am trying to change the permissions of all the files in a particular directory. I have to change their permissions one by one. Is there any wasy such that we can change the permissions of whole directory at once. I mean permissions of all the files at once? Regards, Pratik |
You can use wildcards (*, ?) in the chmod command so this
Code:
chmod ugoa+rw * cheers, jdk |
Also you can use the -R flag to change permission in a directory and sub directories recursively,
Quote:
|
cd dirname
chmod 777 * this will change all the files in dirname to -rwxrwxrwx |
What is this *?
|
If there are subdirectories, containing files, then you can use the recursion option, which causes the command to enter subdirectory trees as well. (see chmod --help)
It is better to give different permissions to directories than you do for files. Only programs and scripts should have the 'x' bit set. But you want directories to have the 'x' bit set. For directories, the 'x' bit allows you to enter them. You can use the `find' command to find just files or just directories: find . -type d -exec chmod ug=rwx,o= '{}' \; find . -type f -exec chmod ug=r,o= '{}' \; The '{}' characters is a place holder for the file found. |
* is special character (wild card) denotes everything is a directory.
|
* is a wild card (special character denotes everything in a directory)
|
um, will 'chmod -R dirname' do it
|
@NightHorse
it worked.. thanks |
You are welcome. :)
|
All times are GMT -5. The time now is 04:56 PM. |