Posted By

ginoplusio on 10/30/09


Tagged

recursive chmod


Versions (?)

Recursive chmod


 / Published in: PHP
 

URL: http://www.barattalo.it/2010/01/19/recursive-chmod-on-files-and-directory/

recursively chmod files to 644 and directories to 755

  1. // recursively chmod files to 644 and directories to 755
  2. function rchmod($dir) {
  3. foreach (glob("$dir/*") as $child) {
  4. chmod($child, (is_dir($child)? rchmod($child): 0644));
  5. }
  6. return 0755;
  7. }
  8.  
  9. // example on dir "db-images":
  10. rchmod("./db-images");

Report this snippet  

You need to login to post a comment.