note 78610 added to function.rmdir
| From: | memso at memso dot net | Date: | Fri, 19 Oct 2007 02:17:55 +0000 |
| Subject: | note 78610 added to function.rmdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131528@lists.php.net to get a copy of this message | ||
For anybody who caches their directory listing ahead of time in an array and wants to recursively
clear out without using opendir and readdir during the delete, you might encounter "directory
not empty" errors even when the directories really are empty because PHP leaves the last
directory opened with opendir open until the end of the script (or you call closedir).
To get around this problem, you should either use closedir every time you are done with a directory,
or if you cannot fix the code that opens the directory yourself, you can add a
closedir(opendir($_SERVER["DOCUMENT_ROOT"]));
before your recursive delete.
----
Server IP: 69.147.83.197
Probable Submitter: 63.231.56.43
----
Manual Page -- http://www.php.net/manual/en/function.rmdir.php
Edit -- https://master.php.net/note/edit/78610
Del: integrated -- https://master.php.net/note/delete/78610/integrated
Del: useless -- https://master.php.net/note/delete/78610/useless
Del: bad code -- https://master.php.net/note/delete/78610/bad+code
Del: spam -- https://master.php.net/note/delete/78610/spam
Del: non-english -- https://master.php.net/note/delete/78610/non-english
Del: in docs -- https://master.php.net/note/delete/78610/in+docs
Del: other reasons-- https://master.php.net/note/delete/78610
Reject -- https://master.php.net/note/reject/78610
Search -- https://master.php.net/manage/user-notes.php