List Info

Thread: note 78021 added to function.rmdir




note 78021 added to function.rmdir
user name
2007-09-24 13:22:50
another simple recursive function deleting a directory
<?
function removeDirRecursive($toDelete)
{
	$dir = opendir($toDelete);
		
	while(false !== ($file = readdir($dir)))
	{
		if(($file != '.') AND ($file != '..'))
		{
		    if(is_dir($toDelete.'/'.$file))
                    {
                       
removeDirRecursive($toDelete.'/'.$file);
                    }

                if(is_file($toDelete.'/'.$file))
                                    
unlink($toDelete.'/'.$file);
		}
	}
	closedir($dir);
	rmdir($toDelete);
	return true;
	}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 84.58.207.56
----
Manual Page -- http:
//www.php.net/manual/en/function.rmdir.php
Edit        -- https://master
.php.net/note/edit/78021
Del: integrated  -- h
ttps://master.php.net/note/delete/78021/integrated
Del: useless     -- http
s://master.php.net/note/delete/78021/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/78021/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/78021/spam
Del: non-english -- 
https://master.php.net/note/delete/78021/non-english
Del: in docs     -- http
s://master.php.net/note/delete/78021/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78021
Reject      -- https://mast
er.php.net/note/reject/78021
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


note 78021 deleted from function.rmdir by ezyang
user name
2007-09-24 18:59:25
Note Submitter: michael
Reason: useless

----

another simple recursive function deleting a directory
<?
function removeDirRecursive($toDelete)
{
	$dir = opendir($toDelete);
		
	while(false !== ($file = readdir($dir)))
	{
		if(($file != '.') AND ($file != '..'))
		{
		    if(is_dir($toDelete.'/'.$file))
                    {
                       
removeDirRecursive($toDelete.'/'.$file);
                    }

                if(is_file($toDelete.'/'.$file))
                                    
unlink($toDelete.'/'.$file);
		}
	}
	closedir($dir);
	rmdir($toDelete);
	return true;
	}
?>

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )