Recursive chmod


/ Published in: PHP
Save to your folder(s)

recursively chmod files to 644 and directories to 755


Copy this code and paste it in your HTML
  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");

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.