note 92676 deleted from function.chgrp by danbrown

From: Date: Mon, 03 Aug 2009 19:40:44 +0000
Subject: note 92676 deleted from function.chgrp by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159060@lists.php.net to get a copy of this message
Note Submitter: david at ordal dot com ---- A recursive chgrp, based on nicolas@infosoft...'s recursive chmod. <?php function chgrpr($path, $uid) { if (!is_dir($path)) return chgrp($path, $uid); $dh = opendir($path); while (($file = readdir($dh)) !== false) { if($file != '.' && $file != '..') { $fullpath = $path.'/'.$file; if(is_link($fullpath)) return FALSE; elseif(!is_dir($fullpath) && !chgrp($fullpath, $uid)) return FALSE; elseif(!chgrpr($fullpath, $uid)) return FALSE; } } closedir($dh); if(chgrp($path, $uid)) return TRUE; else return FALSE; } ?>

« previous php.notes (#159060) next »