$path = "/home/user/public_html/client/"; // <-- Path to the location of files $files = scandir($path); for ($i = 0; $i < sizeof($files); $files += 1) { print $files[i]; if $is_dir($files[i]) { print "Client " $files[i]; } else { print "-- " $files[i]; } }