note 102557 added to function.rmdir

[email protected] Mon, 21 Feb 2011 06:23:20 -0800
Newsgroups php.notes
Message-ID <[email protected]>
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