note 32265 deleted from function.rmdir by tomsommer
| From: | tomsommer@php.net | Date: | Sat, 07 Aug 2004 23:46:04 +0000 |
| Subject: | note 32265 deleted from function.rmdir by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74161@lists.php.net to get a copy of this message | ||
Note Submitter:
----
I have made this script and testet it, and it works just fine.
The script will remove all the directories in $testdir, the directories have to be empty.
<?
$testdir = "one/two/three/four/five/six/seven/eight/nine/ten";
$dir = explode("/", $testdir);
$count = count($dir);
$i = "0";
while($i < $count) {
$path = "";
$x = count($dir)-1-$i;
$y = "0";
while($x >= 0) {
if ($y == "0") {
$path = $dir[$y];
} else {
$path = $path . "/" . $dir[$y];
}
$y = $y+1;
$x = $x-1;
}
rmdir($path);
$i = $i+1;
}
?>