<?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>Komentarze do wpisu: Czyszczenie/usuwanie katalogu w PHP</title>
	<atom:link href="http://wronx.net/otherworld/2008/10/09/czyszczenieusuwanie-katalogu-w-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://wronx.net/otherworld/2008/10/09/czyszczenieusuwanie-katalogu-w-php/</link>
	<description>bo nic nie zastąpi kodu źródłowego...</description>
	<lastBuildDate>Mon, 09 Jan 2012 21:38:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>Przez: kajetan</title>
		<link>http://wronx.net/otherworld/2008/10/09/czyszczenieusuwanie-katalogu-w-php/comment-page-1/#comment-320</link>
		<dc:creator>kajetan</dc:creator>
		<pubDate>Mon, 09 Jan 2012 21:38:58 +0000</pubDate>
		<guid isPermaLink="false">http://wronx.net/blog/?p=91#comment-320</guid>
		<description>Oki
Skrypt się przyda, nota autorska zachowana i link w źródle do tej strony i kupię whiskasa.</description>
		<content:encoded><![CDATA[<p>Oki<br />
Skrypt się przyda, nota autorska zachowana i link w źródle do tej strony i kupię whiskasa.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Przez: WRonX</title>
		<link>http://wronx.net/otherworld/2008/10/09/czyszczenieusuwanie-katalogu-w-php/comment-page-1/#comment-319</link>
		<dc:creator>WRonX</dc:creator>
		<pubDate>Mon, 02 Jan 2012 22:02:57 +0000</pubDate>
		<guid isPermaLink="false">http://wronx.net/blog/?p=91#comment-319</guid>
		<description>@kajetan:
Podpisz mnie w źródle i kup puszkę Whiskasa jakiemuś bezdomnemu kotu, a możesz robić z tym kodem, co tylko zechcesz :)
&lt;em&gt;(w przypadku projektów komercyjnych o większej skali, należy ufundować odpowiednio większą ilość kociego żarcia np. dla &lt;a href=&quot;http://afn.pl&quot; rel=&quot;nofollow&quot;&gt;Fundacji AFN&lt;/a&gt;)&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>@kajetan:<br />
Podpisz mnie w źródle i kup puszkę Whiskasa jakiemuś bezdomnemu kotu, a możesz robić z tym kodem, co tylko zechcesz :)<br />
<em>(w przypadku projektów komercyjnych o większej skali, należy ufundować odpowiednio większą ilość kociego żarcia np. dla <a href="http://afn.pl" rel="nofollow">Fundacji AFN</a>)</em></p>
]]></content:encoded>
	</item>
	<item>
		<title>Przez: kajetan</title>
		<link>http://wronx.net/otherworld/2008/10/09/czyszczenieusuwanie-katalogu-w-php/comment-page-1/#comment-318</link>
		<dc:creator>kajetan</dc:creator>
		<pubDate>Fri, 30 Dec 2011 20:17:15 +0000</pubDate>
		<guid isPermaLink="false">http://wronx.net/blog/?p=91#comment-318</guid>
		<description>Czegoś takiego szukałem, działa świetnie z poziomu Crona.
Jaką licencję ma ten kod?
CZy można wykorzystać w komercyjnym projekcie?</description>
		<content:encoded><![CDATA[<p>Czegoś takiego szukałem, działa świetnie z poziomu Crona.<br />
Jaką licencję ma ten kod?<br />
CZy można wykorzystać w komercyjnym projekcie?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Przez: marek</title>
		<link>http://wronx.net/otherworld/2008/10/09/czyszczenieusuwanie-katalogu-w-php/comment-page-1/#comment-194</link>
		<dc:creator>marek</dc:creator>
		<pubDate>Wed, 23 Sep 2009 11:14:42 +0000</pubDate>
		<guid isPermaLink="false">http://wronx.net/blog/?p=91#comment-194</guid>
		<description>Problem w tym, że nie wywala podkatalogów. Trzeba zapętlić funkcję w funkcji. To podobno obciąża serwer, ale jest do zrobienia. czyli:

&lt;pre lang=&quot;php&quot;&gt;
function EmptyDir($dirName, $rmDir = false)
{
  if($dirHandle = opendir($dirName)) 
  {
    while(false !== ($dirFile = readdir($dirHandle)))
      if ($dirFile != &quot;.&quot; &amp;&amp; $dirFile != &quot;..&quot;) 
      
      // tu moje, bo problem z katalogiem wewnątrz
      if(is_dir($dirName . &quot;/&quot; . $dirFile)){EmptyDir($dirName . &quot;/&quot; . $dirFile, true);}
      else
      //koniec mojego z katalogiem wewnątrz
      
        if(!unlink($dirName . &quot;/&quot; . $dirFile))
          return false;
    closedir($dirHandle); 
    if($rmDir)
      if(!rmdir($dirName))
        return false;
    return true;
  }
  else
    return false;
}
&lt;/pre&gt;

&lt;em&gt;edit (WRonX): &lt;strong&gt;oczywiście nie ponoszę odpowiedzialności za ten kod, bo nie chciało mi się go przetestować :)&lt;/stron&gt;&lt;/em&gt;</description>
		<content:encoded><![CDATA[<p>Problem w tym, że nie wywala podkatalogów. Trzeba zapętlić funkcję w funkcji. To podobno obciąża serwer, ale jest do zrobienia. czyli:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> EmptyDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dirName</span><span style="color: #339933;">,</span> <span style="color: #000088;">$rmDir</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</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;">$dirHandle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">opendir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dirName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> 
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">!==</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$dirFile</span> <span style="color: #339933;">=</span> <span style="color: #990000;">readdir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dirHandle</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$dirFile</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;.&quot;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$dirFile</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;..&quot;</span><span style="color: #009900;">&#41;</span> 
&nbsp;
      <span style="color: #666666; font-style: italic;">// tu moje, bo problem z katalogiem wewnątrz</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;">$dirName</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$dirFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>EmptyDir<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dirName</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$dirFile</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</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: #666666; font-style: italic;">//koniec mojego z katalogiem wewnątrz</span>
&nbsp;
        <span style="color: #b1b100;">if</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;">$dirName</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$dirFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
          <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">closedir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dirHandle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rmDir</span><span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">if</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;">$dirName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span>
    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><em>edit (WRonX): <strong>oczywiście nie ponoszę odpowiedzialności za ten kod, bo nie chciało mi się go przetestować :)</strong></em></p>
]]></content:encoded>
	</item>
</channel>
</rss>

