Return to Snippet

Revision: 32747
at November 6, 2012 08:48 by jprochazka


Updated Code
<?php
function listFiles($dir)
{
  if(is_dir($dir)){
    if($handle = opendir($dir)){
      while(($file = readdir($handle)) !== false){
        if($file != "." &amp;&amp; $file != ".." &amp;&amp; $file != "Thumbs.db"{
          echo '<a target="_blank" href="'.$dir.$file.'">'.$file.'</a><br/>'."\n";
        }
      }
      closedir($handle);
    }
  }
}

?>

Revision: 32746
at October 2, 2010 01:35 by jprochazka


Updated Code
<?php

function list_files($dir)
{
  if(is_dir($dir)){
    if($handle = opendir($dir)){
      while(($file = readdir($handle)) !== false){
        if($file != "." &amp;&amp; $file != ".." &amp;&amp; $file != "Thumbs.db"{
          echo '<a target="_blank" href="'.$dir.$file.'">'.$file.'</a><br/>'."\n";
        }
      }
      closedir($handle);
    }
  }
}

?>

Revision: 32745
at October 2, 2010 01:34 by jprochazka


Initial Code
<?php

function list_files($dir)
{
  if(is_dir($dir)){
    if($handle = opendir($dir)){
      while(($file = readdir($handle)) !== false){
        if($file != "." &amp;&amp; $file != ".." &amp;&amp; $file != "Thumbs.db"{
          echo '<a target="_blank" href="'.$dir.$file.'">'.$file.'</a><br/>'."\n";
        }
      }
      closedir($handle);
    }
  }
}

?>

Initial URL

                                

Initial Description
List files within a directory while ignoring system folders such as "Thumbs.db" as well as "." and "..".

Initial Title
Get a directory listing.

Initial Tags

                                

Initial Language
PHP