note 11988 added to function.rmdir.php
| From: | s-walker at ti dot com | Date: | Fri, 16 Mar 2001 17:33:03 +0000 |
| Subject: | note 11988 added to function.rmdir.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12475@lists.php.net to get a copy of this message | ||
I couldn't get the dir class version of the recursive rmdir to work on WinNT/Apache
1.3.12/PHP4.0.4pl1. But the regular dir handle stuff worked great.
function RmDirR ($dirName) {
$d = opendir ($dirName);
while($entry = readdir($d)) {
if ($entry != "." && $entry != ".." && $entry !=
"") {
if (Is_Dir($dirName."/".$entry)) {
RmDirR($dirName."/".$entry);
} else {
UnLink ($dirName."/".$entry);
}
}
}
closedir($d);
RmDir ($dirName);
}
http://www.php.net/manual/en/function.rmdir.php