remove duplicates RecursiveIteratorIterator
<p>I was thinking of using RecursiveIteratorIterator to display the "top-directories", in my example layout and puffar, but I cannot get it to work. The structure is as follows:</p>

<pre><code>| images |
  =&gt; layout
       =&gt;lab
  =&gt; puffar 
</code></pre>

<p>and the result is</p>

<pre><code>layout
layout
layout
layout/lab
layout/lab
puffar
puffar


$directory = 'images';

    $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));

    while($it-&gt;valid()) {

    if (!$it-&gt;isDot()) {       
        echo $it-&gt;getSubPath() . "\n";       
    }

    $it-&gt;next();
    }
</code></pre>

<p>another thing that I cannot get to work is if I change the directory path to </p>

<pre><code>$directory = 'newsletter.site.se/images';
</code></pre>

<p>it is not displaying anything. 
It would be fantasic if someone could help me. thanks linda</p>
