note 86992 modified in function.is-file by thiago

From: Date: Thu, 13 Nov 2008 16:19:16 +0000
Subject: note 86992 modified in function.is-file by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-146503@lists.php.net to get a copy of this message
This Function deletes everything in a defined Folder: Works with PHP 4 and 5. <?php function deletefolder($path) { if ($handle=opendir($path)) { while (false!==($file=readdir($handle))) { if ($file<>"." AND $file<>"..") { if (is_file($path.'/'.$file)) { @unlink($path.'/'.$file); } if (is_dir($path.'/'.$file)) { deletefolder($path.'/'.$file); @rmdir($path.'/'.$file); } } } } } ?> --was-- This Function deletes everything in a defined Folder: Works with PHP 4 and 5. function deletefolder($path) { if ($handle=opendir($path)) { while (false!==($file=readdir($handle))) { if ($file<>"." AND $file<>"..") { if (is_file($path.'/'.$file)) { @unlink($path.'/'.$file); } if (is_dir($path.'/'.$file)) { deletefolder($path.'/'.$file); @rmdir($path.'/'.$file); } } } } } http://php.net/manual/en/function.is-file.php

« previous php.notes (#146503) next »