note 80360 added to function.rmdir
| From: | anders dot carlsson at dwm dot se | Date: | Fri, 11 Jan 2008 20:09:23 +0000 |
| Subject: | note 80360 added to function.rmdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135033@lists.php.net to get a copy of this message | ||
All of you who proposed routines for recursive deletion of a directory tree, I have one suggestion:
if (is_dir($f) && !is_link($f)) { ... }
Otherwise, if you happen to have a symbolic link to a directory outside of the one you plan to
remove and also have permissions enough to wipe that too, nasty things could happen. It just
happened to me, and I had to retrieve lost files from the backup. :-/
----
Server IP: 212.63.193.10
Probable Submitter: 90.224.255.99
----
Manual Page -- http://www.php.net/manual/en/function.rmdir.php
Edit -- https://master.php.net/note/edit/80360
Del: integrated -- https://master.php.net/note/delete/80360/integrated
Del: useless -- https://master.php.net/note/delete/80360/useless
Del: bad code -- https://master.php.net/note/delete/80360/bad+code
Del: spam -- https://master.php.net/note/delete/80360/spam
Del: non-english -- https://master.php.net/note/delete/80360/non-english
Del: in docs -- https://master.php.net/note/delete/80360/in+docs
Del: other reasons-- https://master.php.net/note/delete/80360
Reject -- https://master.php.net/note/reject/80360
Search -- https://master.php.net/manage/user-notes.php