note 32265 added to function.rmdir
| From: | php-general at lists dot php dot net | Date: | Wed, 21 May 2003 23:18:44 +0000 |
| Subject: | note 32265 added to function.rmdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48798@lists.php.net to get a copy of this message | ||
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;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.rmdir.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32265
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32265&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32265&report=yes