note 83923 deleted from function.rmdir by felipe
| From: | felipe@php.net | Date: | Thu, 19 Jun 2008 18:15:18 +0000 |
| Subject: | note 83923 deleted from function.rmdir by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-140591@lists.php.net to get a copy of this message | ||
Note Submitter: dmms at yandex dot ru
Reason: 4
----
ЧÑÑÑ Ð¿Ð¾Ð´Ð¿Ñавил $filepath
function rm_dir($filepath){
if (is_dir($filepath) && !is_link($filepath))
{
if ($dh = opendir($filepath))
{
while (($sf = readdir($dh)) !== false)
{
if ($sf == '.' || $sf == '..')
{
continue;
}
$filepath = (substr($filepath, -1) != "/")?
$filepath."/":$filepath;
if (!rm_dir($filepath.$sf))
{
echo ($filepath.$sf.' could not be deleted.');
}
}
closedir($dh);
}
return rmdir($filepath);
}
return unlink($filepath);
}