note 89497 added to function.rmdir

From: Date: Wed, 11 Mar 2009 09:44:46 +0000
Subject: note 89497 added to function.rmdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-151716@lists.php.net to get a copy of this message
Thanks for that compact recursive delete function. Note that it does not delete the directory initially passed to it. rmdir it afterwards or modify the function like this: function rmdir_recurse($path) { $path= rtrim($path, '/').'/'; $handle = opendir($path); for (;false !== ($file = readdir($handle));) if($file != "." and $file != ".." ) { $fullpath= $path.$file; if( is_dir($fullpath) ) { rmdir_recurse($fullpath); } else { unlink($fullpath); } } closedir($handle); rmdir($path); } ---- Server IP: 194.153.94.10 Probable Submitter: 84.73.174.204 ---- Manual Page -- http://www.php.net/manual/en/function.rmdir.php Edit -- https://master.php.net/note/edit/89497 Del: integrated -- https://master.php.net/note/delete/89497/integrated Del: useless -- https://master.php.net/note/delete/89497/useless Del: bad code -- https://master.php.net/note/delete/89497/bad+code Del: spam -- https://master.php.net/note/delete/89497/spam Del: non-english -- https://master.php.net/note/delete/89497/non-english Del: in docs -- https://master.php.net/note/delete/89497/in+docs Del: other reasons-- https://master.php.net/note/delete/89497 Reject -- https://master.php.net/note/reject/89497 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151716) next »