Skip to content

Instantly share code, notes, and snippets.

@cezarderevlean
Created November 27, 2013 10:18
Show Gist options
  • Save cezarderevlean/7673511 to your computer and use it in GitHub Desktop.
Save cezarderevlean/7673511 to your computer and use it in GitHub Desktop.
<?php
$files = array();
$dir = opendir('.'); // open the cwd..also do an err check.
while(false != ($file = readdir($dir))) {
if(($file != ".") and ($file != "..") and ($file != "index.php")) {
$files[] = $file; // put in array.
}
}
natsort($files); // sort.
// print.
foreach($files as $file) {
if (strpos($file,'.html') !== false) {
echo("<a href='$file'>$file</a> <br />\n");
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment