note 84273 modified in function.chmod by felipe

From: Date: Mon, 17 Nov 2008 00:19:52 +0000
Subject: note 84273 modified in function.chmod by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146610@lists.php.net to get a copy of this message
I use the code of haasje@welmers.net, but have a lite alteration. (linux symlink) <?php function chmod_R($path, $filemode) { if (!is_dir($path)) return chmod($path, $filemode); $dh = opendir($path); while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..') { $fullpath = $path.'/'.$file; if(is_link($fullpath)) return FALSE; elseif(!is_dir($fullpath)) if (!chmod($fullpath, $filemode)) return FALSE; elseif(!chmod_R($fullpath, $filemode)) return FALSE; } } closedir($dh); if(chmod($path, $filemode)) return TRUE; else return FALSE; } ?> thanks alls --was-- I use the code of haasje@welmers.net, but have a lite alteration. (linux symlink) <?php function chmod_R($path, $filemode) { if (!is_dir($path)) return chmod($path, $filemode); $dh = opendir($path); while ($file = readdir($dh)) { if($file != '.' && $file != '..') { $fullpath = $path.'/'.$file; if(is_link($fullpath)) return FALSE; elseif(!is_dir($fullpath)) if (!chmod($fullpath, $filemode)) return FALSE; elseif(!chmod_R($fullpath, $filemode)) return FALSE; } } closedir($dh); if(chmod($path, $filemode)) return TRUE; else return FALSE; } ?> thanks alls http://php.net/manual/en/function.chmod.php

« previous php.notes (#146610) next »