Skip to content

Instantly share code, notes, and snippets.

@handlename
Created October 6, 2010 08:50
Show Gist options
  • Save handlename/613041 to your computer and use it in GitHub Desktop.
Save handlename/613041 to your computer and use it in GitHub Desktop.
<?php
function getFileList($dir_path)
{
if(! is_dir($dir_path))
{
return array();
}
$list = array();
$dir = opendir($dir_path);
while($filename = readdir($dir))
{
if($filename == '.' || $filename == '..') continue;
$path = $dir_path .'/'. $filename;
if(is_dir($path))
{
$list = array_merge($list, getFileList($path));
}
else
{
$list[] = $path;
}
}
closedir($dir);
return $list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment