$dir = dirname(__FILE__); if ($dh = opendir($dir)) { while (false !== ($file = readdir($dh))) { if ($file != "." && $file != "..") { echo "$file\n"; } } closedir($dh); }