使用 find 快速修改 目錄下的 檔案/目錄 權限 要將目錄下 *.php 的權限改成 664. find ./ -name '*.php' -exec chmod 664 {} ";" 修改所有檔案權限都為 644 find . -type f -exec sudo chmod 644 {} + 修改所有目錄權限為 755 find . -type d -exec sudo chmod 755 {} + find 上述的解說 {} :find 找到的檔名 + : 結束 分享此文:電子郵件列印FacebookLinkedInTwitterPocket 相關 作者: Tsung 對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活. 檢視「Tsung」的全部文章
根據 http://superuser.com/questions/91935/how-to-chmod-755-all-directories-but-no-file-recursively 這裡的資料顯示, find . -type f -print0 | xargs -0 chmod 644 會比 find . -type f -exec sudo chmod 644 {} + 更好喔,可以避免每次 find 都要產生一個 chmod 子程序,速度會快不少。 回覆
剛剛的留言有點小錯誤 😛 ,要把 find . -type f -print0 | xargs -0 chmod 644 改成 find . -type f -print0 | xargs -0 sudo chmod 644
根據 http://superuser.com/questions/91935/how-to-chmod-755-all-directories-but-no-file-recursively 這裡的資料顯示,
find . -type f -print0 | xargs -0 chmod 644
會比
find . -type f -exec sudo chmod 644 {} +
更好喔,可以避免每次 find 都要產生一個 chmod 子程序,速度會快不少。
剛剛的留言有點小錯誤 😛 ,要把
find . -type f -print0 | xargs -0 chmod 644
改成
find . -type f -print0 | xargs -0 sudo chmod 644