note 102557 added to function.rmdir

From: Date: Mon, 21 Feb 2011 14:23:20 +0000
Subject: note 102557 added to function.rmdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-177182@lists.php.net to get a copy of this message
Here is another example for recursive remove directory. The parameter string must ends with "/". Quite simple. function rrmdir($dir) { $files = glob( $dir . '*'); foreach( $files as $file ){ if( is_dir($file) ) { rrmdir( $file."/"); rmdir($file."/"); }else unlink($file); } } rrmdir("./upload/"); // call example ---- Server IP: 69.147.83.197 Probable Submitter: 186.24.0.132 ---- Manual Page -- http://www.php.net/manual/en/function.rmdir.php Edit -- https://master.php.net/note/edit/102557 Del: integrated -- https://master.php.net/note/delete/102557/integrated Del: useless -- https://master.php.net/note/delete/102557/useless Del: bad code -- https://master.php.net/note/delete/102557/bad+code Del: spam -- https://master.php.net/note/delete/102557/spam Del: non-english -- https://master.php.net/note/delete/102557/non-english Del: in docs -- https://master.php.net/note/delete/102557/in+docs Del: other reasons-- https://master.php.net/note/delete/102557 Reject -- https://master.php.net/note/reject/102557 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#177182) next »