คำสั่ง chmod File หรือ Folders อย่างเดียว

By | 10/09/2013

To recursively give directories read&execute privileges:

find /path/to/base/dir -type d -exec chmod 755 {} \;

To recursively give files read privileges:

find /path/to/base/dir -type f -exec chmod 644 {} \;

Or, if there are many objects to process:

chmod 755 $(find /path/to/base/dir -type d)
chmod 644 $(find /path/to/base/dir -type f)

Or, to reduce chmod spawning:

find /path/to/base/dir -type d -print0 | xargs -0 chmod 755 
find /path/to/base/dir -type f -print0 | xargs -0 chmod 644

Cradit
http://stackoverflow.com/questions/3740152/how-to-set-chmod-for-a-folder-and-all-of-its-subfolders-and-files-in-linux-ubunt
http://superuser.com/questions/91935/how-to-chmod-755-all-directories-but-no-file-recursively

ใส่ความเห็น