function listDirectory($path) { $handle = @opendir($path); while (false !== ($file = readdir($handle))) { if ($file == '.' || $file == '..') continue; if ( is_dir("$path/$file")) { echo "$path/$file\n"; listDirectory("$path/$file"); } else { echo "$path/$file\n"; } } closedir($handle); } listDirectory("tutorials");