<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP Script for recursively deleting a folder and all of its contents, subfolders and files</title>
	<atom:link href="http://codingrecipes.com/php-script-for-recursively-deleting-a-folder-and-all-of-its-contents-subfolders-and-files/feed" rel="self" type="application/rss+xml" />
	<link>http://codingrecipes.com/php-script-for-recursively-deleting-a-folder-and-all-of-its-contents-subfolders-and-files</link>
	<description></description>
	<lastBuildDate>Sun, 22 Jan 2012 07:31:56 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<item>
		<title>By: Codehead</title>
		<link>http://codingrecipes.com/php-script-for-recursively-deleting-a-folder-and-all-of-its-contents-subfolders-and-files/comment-page-1#comment-78</link>
		<dc:creator>Codehead</dc:creator>
		<pubDate>Tue, 31 Mar 2009 18:04:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.code-head.com/?p=352#comment-78</guid>
		<description>Thanks Tim, this is what you get for not looking at the list of available functions :)</description>
		<content:encoded><![CDATA[<p>Thanks Tim, this is what you get for not looking at the list of available functions <img src='http://codingrecipes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Cooper</title>
		<link>http://codingrecipes.com/php-script-for-recursively-deleting-a-folder-and-all-of-its-contents-subfolders-and-files/comment-page-1#comment-77</link>
		<dc:creator>Tim Cooper</dc:creator>
		<pubDate>Tue, 31 Mar 2009 10:10:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.code-head.com/?p=352#comment-77</guid>
		<description>&lt;pre lang=&quot;php&quot;&gt;
function removeDir($dir){
	$dir = rtrim($dir, &#039;/&#039;);
	$contents = scandir($dir);
	foreach($contents as $item){
		if($item != &#039;.&#039; &amp;&amp; $item != &#039;..&#039;){
			$item = $dir . &#039;/&#039; . $item;
			if(is_dir($item)){
				removeDir($item);
			}else{
				if(!(@unlink($item))){
					throw new Exception(&#039;Unable to remove file:&#039; . $item);
				}
			}
		}
	}
	if(!(@rmdir($dir))){
		throw new Exception(&#039;Unable to remove dir:&#039; . $item);
	}
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> removeDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> scandir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$contents</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'.'</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$item</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'..'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$item</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$dir</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_dir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				removeDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Unable to remove file:'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #990000;">rmdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Unable to remove dir:'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: jesusvld</title>
		<link>http://codingrecipes.com/php-script-for-recursively-deleting-a-folder-and-all-of-its-contents-subfolders-and-files/comment-page-1#comment-76</link>
		<dc:creator>jesusvld</dc:creator>
		<pubDate>Tue, 23 Sep 2008 22:55:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.code-head.com/?p=352#comment-76</guid>
		<description>Excelente tip. Thank you for share.</description>
		<content:encoded><![CDATA[<p>Excelente tip. Thank you for share.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

