Removing periods in directory listing..
Posted: Mon Mar 29, 2004 9:57 pm
You know when you view a directory how it looks like this:
.
..
fileone.php
filetwo.php
Well? Using the script below how would I remove the . and .. from showing up on the page with all my other files.. I tried adding them to the exclude array but it didn't work..
thanks!
.
..
fileone.php
filetwo.php
Well? Using the script below how would I remove the . and .. from showing up on the page with all my other files.. I tried adding them to the exclude array but it didn't work..
Code: Select all
<?
$maindir = "." ;
$mydir = opendir($maindir) ;
$exclude = array( "index.php") ;
while($fn = readdir($mydir)) {
if ($fn == $exclude[0] || $fn == $exclude[1]) continue;
echo "<br><a href='$fn'>$fn</a>";
}
closedir($mydir);
?>