title: PHP Glob, exclude directories containing .files in their name
body: <p>I am using glob to find directories inside the current one where my index file is. Inside it i am saving html pages extracted from EXCEL and they create folders directories ending in .files Is there a way to glob all directories but exclude those ending in .files?</p>
  
  <p>Here is my code as it's currently:</p>
  
  <pre><code>&lt;?php
  // set to current directory 
  $dir = '';
  
  // directories only. ignore files, etc.
  foreach(glob($dir.'*', GLOB_ONLYDIR) as $folder){ 
  // do not include wordpress directories
    if (($folder != '*') &amp;&amp; ($folder != 'ΦΥΛΑΚΕΣ ΠΡΑΤΗΡΙΩΝ.files') &amp;&amp; ($folder != 'wp-includes')) { 
    // list directories and their links
  ?&gt; 
      &lt;li&gt;&lt;a href="&lt;?php echo $dir."/files/".$folder;?&gt;"&gt;&lt;?php echo $folder;?&gt;&lt;/li&gt; 
  &lt;?php 
    }
  } 
  ?&gt;
  </code></pre>
  
  <p>EDIT: As you can see i can exclude specified folders but i want it to exclude automatically all folders ending in .files as i said.</p>