Skip to content

Instantly share code, notes, and snippets.

@takuya
Created February 7, 2012 09:16
Show Gist options
  • Save takuya/1758507 to your computer and use it in GitHub Desktop.
Save takuya/1758507 to your computer and use it in GitHub Desktop.
ディレクトリ中のファイルを一覧 ref: http://qiita.com/items/2041
function scan_files_in_dir($dir){
$cwd = getcwd();
chdir($dir);
$list = scandir("$dir/vendor") ;
foreach( $list as $idx=> $dirname){
if( $dirname == "." ){ unset($list[$idx] ); continue; }
if( $dirname == ".." ){ unset($list[$idx] ); continue;}
if( is_dir($dirname) === true ){ unset($list[$idx] ) ;continue;}
$list[$idx] = getcwd()."/".$dirname;
};
chdir($cwd);
if(!$list){return array();}
return $list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment