note 27279 deleted from function.rmdir by tomsommer
| From: | tomsommer@php.net | Date: | Sat, 07 Aug 2004 23:47:02 +0000 |
| Subject: | note 27279 deleted from function.rmdir by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74165@lists.php.net to get a copy of this message | ||
Note Submitter: chris@hotmail.com
----
a simple addon to georg's function...this confirms all of the deletes....also its kinda cool to
see it all build up.
<?php
function delete($file) {
chmod($file,0777);
if (is_dir($file)) {
$handle = opendir($file);
while($filename = readdir($handle)) {
if ($filename != "." && $filename != "..") {
delete($file."/".$filename);
}
}
closedir($handle);
rmdir($file);
echo "$file deleted";
} else {
unlink($file);
echo "$file deleted";
}
}
delete("mysql");
echo "<hr>";
delete("member");
echo "<hr>";
delete("home");
echo "<hr>";
delete("news");
echo "<hr>";
delete("mine");
echo "<hr>";
?>