LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Change file permissions of files in folders (http://www.linuxquestions.org/questions/linux-newbie-8/change-file-permissions-of-files-in-folders-555085/)

dotancohen 05-19-2007 02:46 AM

Change file permissions of files in folders
 
I just copied a backup of several hundred folders from a CD in my /home/user direcorty. Originally, the folders themselves were 700 and the files within were all 644. However, on the CD the folders and the files are all 444 for some reason that I cannot fathom.

In order to correct the problem, I figured that I'd chmod everything to 644 and then chmod the folders to 700 like so:
Code:

chmod 644 -R *
chmod 700 *

However, that did not work because the folders got 644'ed first, and then I did not have write permissions to chmod the files! How can I get out of this mess?

Thanks in advance!

dotancohen 05-19-2007 02:56 AM

Solved my own problem! I found the X flag, which I did not know about, in the chmod man page. So this did what I need:
Code:

dotancohen@laptop:$ chmod o=r -R *
dotancohen@laptop:$ chmod g=r -R *
dotancohen@laptop:$ chmod u=rwX -R *
dotancohen@laptop:$ chmod 700 *
dotancohen@laptop:$



All times are GMT -5. The time now is 07:18 PM.