歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 批量更改文件權限

批量更改文件權限

日期:2017/2/28 16:44:42   编辑:Linux教程

如果你發覺一個目錄結構下的大量文件權限(讀、寫、可執行)很亂時,可以執行以下兩個命令批量修正:

chmod 755 -R dir_name

find dir_name -type f -exec chmod 644 {} \;

如果你還有其它的要求,比如將sh或者py文件增加可執行權限,這個就更簡單了:

find dir_name -name “*.sh” -exec chmod 755 {} \;

find dir_name -name “*.py” -exec chmod 755 {} \;

當然,這樣做過後,其它一些可執行程序也相應去掉了可執行權限,比如C的可執行程序。

Do you have any other idea about this problem? If you do, plz let me know.

本文來自http://linux.cuit.edu.cn/?p=375 轉載請注明

Copyright © Linux教程網 All Rights Reserved