http://it.php.net/manual/it/function.readdir.php

c'è un esempio di come usarla nel link