note 70377 deleted from function.rmdir by bobby
| From: | bobby@php.net | Date: | Thu, 19 Oct 2006 15:54:07 +0000 |
| Subject: | note 70377 deleted from function.rmdir by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118780@lists.php.net to get a copy of this message | ||
Note Submitter: stijnleenknegt< at >gmail< dot >com
----
@null at php5 dot pl:
[EDITOR NOTE: Original User Note Removed]
What if their is a subdir in $path? Yeah recursion is the best solution to do it. Nice idea to it
with glob();
<?php
functio removeDir($path)
{
$path.="*";
foreach(glob($path) as $file)
{
if( is_file($file) === true ) {
unlink($file);
} elseif( is_dir($file) === true ) {
removeDir($file);
}
}
}
}
?>