Skip to content

Instantly share code, notes, and snippets.

@sukhmeet2390
Created April 10, 2018 15:58
Show Gist options
  • Save sukhmeet2390/590eeb95babe6dcd27935fe385875d03 to your computer and use it in GitHub Desktop.
Save sukhmeet2390/590eeb95babe6dcd27935fe385875d03 to your computer and use it in GitHub Desktop.
List all the files of a folder index.php
<?php
$path = ".";
$dh = opendir($path);
$i=1;
while (($file = readdir($dh)) !== false) {
if($file != "." && $file != ".." && $file != "index.php" && $file != ".htaccess" && $file != "error_log" && $file != "cgi-bin") {
echo "<a href='$path/$file'>$file</a><br /><br />";
$i++;
}
}
closedir($dh);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment