Recursively chmod/chown/chgrp all files and folder within a directory

前端 未结 3 1615
别那么骄傲
别那么骄傲 2020-12-19 06:17

I am working on a site which builds other sites. Some if it I use copy() to create the files and directories, other times I\'m building XML files in php and using DOMDocume

3条回答
  •  天涯浪人
    2020-12-19 07:14

    You can perform a system call

    system("/bin/chmod -R $mod $root");
    system("/bin/chown -R $user $root");
    system("/bin/chgrp -R $user $root");
    

    of course you use escapeshellarg() or escapeshellcmd() in order to avoid executing arbitrary commands

提交回复
热议问题