To list contents of a directory is simple in PHP, just use three PHP directory functions, opendir, readdir and is_dir.
The code:
<?php 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"); ?>
Here’s the result:

To start list contents, first open the directory handle using opendir then loop to read the entire contents using readdir. Check if content is a directory or a file using is_dir, if a directory, then call function listDirectory to read it’s content (recursive).TV6CA39U8TTG







Just what I was looking for :).
Thank you and take care!