ディレクトリ内にあるファイル一覧を表示するには scandir() や DirectoryIterator クラスを使えばできますが、ディレクトリ内にさらにサブディレクトリが有る場合は再帰的に処理するための工夫が必要です。 方法は2つあり、RecursiveIteratorIterator() と RecursiveDirectoryIterator() を組み合わせる方法と、再帰関数を利用した従来の方法です。 RecursiveIteratorIterator() と RecursiveDirectoryIterator() を使った方法 <?php //検索するディレクトリ $dir = dirname(__FILE__) . '/directory/'; $result = list_files($dir); print_r($result); function list_files