-2

I have a main _web folder wich is holding this structure of folders and files(see below). I am trying to make a bash script which would loop through all the folders and change permissions for files to 640 and directories to 750.

Any suggestion on how could I do this?

/_web/www_svetaine1  - a.html      
                     - b.html
                     - index.html
                 /pictures - a.jpg
                           - b.jpg
                           - c.jpg
                                /icons/a.jpg
/_web/www_svetaine2  - a.html       
                     - b.html
                     - index.html
                 /pictures - a.jpg
                           - b.jpg
                           - c.jpg
                                /icons/a.jpg
/_web/ftp_serveris1  - a.doc    
                     - b.doc
            /visiems - c.doc

/_web/ftp_serveris2  - a.doc    
                     - b.doc   
            /visiems - c.doc
  • Please rewrite your title. A proper title is meant to help others with similar problem in the futur. – Emmanuel Dec 5 '17 at 13:45
4
find /_web -type d -exec chmod 750 {} +
find /_web -type f -exec chmod 640 {} + 
3
find ./_web -type f -exec chmod -v 640 {} \;
find ./_web -type d -exec chmod -v 750 {} \;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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