note 9778 added to closedir
| From: | jeryde at gmx dot de | Date: | Thu, 23 Nov 2000 10:47:55 +0000 |
| Subject: | note 9778 added to closedir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8021@lists.php.net to get a copy of this message | ||
hi there,
i'am running an iis4 with php 4.03pl1 and i got some trouble with the opendir/closedir
commands. may it be that the closedir has a delay before it closes the directory ? after opening a
directory and deleting all files i want to delete the directory itself. but i got a permission
denied. when i only try to delete the directory, without the opendir/closedir command in front, it
works fine. here's the code:
$all=opendir($path);
while ($file=readdir($all))
{
if ($file <> ".." and $file <> ".")
{
unlink($path.$file);
unset($file);
}
}
closedir($all);
$path = substr($path,0,strlen($path)-1);
$cmd = $path;
$cmd = str_replace("\\\\","\\",$cmd);
rmdir ($cmd);
therefor, it seems that he blocks the directorty with the opendir command, but don't set it
free again with the closedir command. so i can't delete it.
does anybody knows a solution ?
http://www.php.net/manual/function.closedir.php