note 95444 deleted from function.rmdir by danbrown

From: Date: Mon, 04 Jan 2010 16:03:53 +0000
Subject: note 95444 deleted from function.rmdir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164615@lists.php.net to get a copy of this message
Note Submitter: jacek at jacekk dot co dot uk ---- I don't think and of the recursive function here actually work so here is my one that does... <?php function rmrf($path){ $files = scandir($path); foreach($files as $file){ if ($file !== '.' && $file !== '..'){ if(is_dir($path.'/'.$file)){ if (count(glob($path.'/'.$file.'/*')) > 0){ rmrf($path.'/'.$file); }else{ rmdir($path.'/'.$file); } }else{ unlink($path.'/'.$file); } } } rmdir($path); } ?>

« previous php.notes (#164615) next »