How to provide 777 permission for multiple directories at once in unix?

I have several subdirectories in the root directory. at that time, I want to grant chmod 777 permission for these directories.

I know individually, we can give chmod -r 777 abcd , but I want to give permission to the directories I ever need.

Example:

 XYZ -- Parent Directory ABCD EGF GHY JHF OIEDF -- These are sub directories. now i want to give chmod 777 to ABCD EGF GHY . at a time to all these directories. 

Thanks at Advance.

+6
source share
1 answer

Assuming XYZ is the path to the root of your files, you can use globbing to exactly match the files you need:

 chmod 777 /XYZ/{ABCD,EGF,GHY} 

You can then use the -R flag to do this recursively in all files and folders contained in these folders.

 chmod -R 777 /XYZ/{ABCD,EGF,GHY} 

To apply non-recursive chmod in folder 3 plus the parent element, you can use:

 chmod 777 /XYZ/{ABCD,EGF,GHY,} 

Pay attention to the last comma to include the directory itself in globbing

+11
source

Source: https://habr.com/ru/post/954933/


All Articles