note 18759 rejected from function.rmdir by torben

From: Date: Mon, 04 Feb 2002 23:05:52 +0000
Subject: note 18759 rejected from function.rmdir by torben
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-26249@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

« previous php.notes (#26249) next »