note 18759 added to function.rmdir

From: Date: Mon, 04 Feb 2002 11:56:42 +0000
Subject: note 18759 added to function.rmdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-26203@lists.php.net to get a copy of this message
Hi all! I have a problem. I want to delete some $filename in some $dirname, and then if this $dirname is empty, delete this $dirname. However, the following script does not work as I expect... <?php if (file_exists($filename)) { if (unlink($filename)) { echo "File successfully deleted."; $arr = array(); $handle=opendir($dirname); rewinddir($handle); while ($file = readdir($handle)) { if (($file != ".") && ($file != "..")) { clearstatcache(); array_push($arr,$file); } } closedir($handle); $count = count($arr); if ($count == 0) if (rmdir($dirname)) echo "Directory successfully deleted..."; else echo "Directory was NOT successfully deleted...!"; } else { echo "File was NOT deleted!"; } } else exit ("File cannot be found!"); ?> It always echoes "Directory was NOT successfully deleted...!"... :-/ In IIS4.0 and NT4.0 full rights is setted for IUSR_SERVERNAME for relevant directory. Can anybody help me? By mail, please. Thanx, Radovan Vojtek -- http://www.php.net/manual/en/function.rmdir.php http://master.php.net/manage/user-notes.php?action=edit+18759 http://master.php.net/manage/user-notes.php?action=delete+18759 http://master.php.net/manage/user-notes.php?action=reject+18759

« previous php.notes (#26203) next »