dai un occhiata qua:
http://ch2.php.net/dir

e piu specificatamente qua:
http://ch2.php.net/manual/en/function.scandir.php