set permissions for all files and folders recursively

前端 未结 5 1191
执笔经年
执笔经年 2021-01-31 04:59

I want to recursively set the folder and file permissions. Folders should get 750 and files 644. I found this and made some adaptions. Would this one work?



        
5条回答
  •  [愿得一人]
    2021-01-31 05:23

    Why don't use find tool for this?

    exec ("find /path/to/folder -type d -exec chmod 0750 {} +");
    exec ("find /path/to/folder -type f -exec chmod 0644 {} +");
    

提交回复
热议问题