#!/bin/bash
# 项目文件夹、文件权限修改
# 批量修改文件夹或者文件的权限时,需要先忽略掉可写文件夹('./bootstrap/cache''./public/attachments''./public/images''./storage')

# 忽略 './bootstrap/cache' './public/attachments' './public/images' './storage' 文件夹及子文件
ignore_path="-not -path './bootstrap/cache' -and -not -path './bootstrap/cache/*' -and -not -path './public/attachments' -and -not -path './public/attachments/*' -and -not -path './public/images' -and -not -path './public/images/*' -and -not -path './storage' -and -not -path './storage/*'"
find_dirs="find . -type d $ignore_path"
find_files="find . -type f $ignore_path"
# 修改文件夹权限为 555
chmod_dirs="sudo $find_dirs -exec chmod 555 {} \;"
# 修改文件权限为 444
chmod_files="sudo $find_files -exec chmod 444 {} \;"


#echo $chmod_dirs
#echo $chmod_files
eval $chmod_dirs; eval $chmod_files

 

相关文章:

  • 2021-09-01
  • 2021-10-13
  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2021-04-17
  • 2021-12-25
猜你喜欢
  • 2022-12-23
  • 2021-12-12
  • 2021-08-10
  • 2022-12-23
  • 2021-06-24
  • 2021-09-02
  • 2021-06-07
相关资源
相似解决方案