$folder=opendir("./files"); while(false !== ($k = readdir($folder))){ if($k!="." && $k!="..") echo "<a href=http://lol.ru/>$k</a>\r\n"; }