trying to ignore one file within a list
Posted: Sun May 17, 2009 2:57 pm
Hi, I'm using the php code below to list the contents of a folder. However, in that folder, I want to ignore one thing. In this case, it's the .htaccess. i don't want this to appear in this list or show up as a link. Would someone mind showing me the process for doing this? Essentially, I would like to modify the code below so that .htaccess will not show up.
Thank you,
Saul
.htaccess
accents
bassdrums
claps
crashes
hats
index.html
signnocker_bd.mp3
small pitched_bd.mp3
snares
toms
Thank you,
Saul
.htaccess
accents
bassdrums
claps
crashes
hats
index.html
signnocker_bd.mp3
small pitched_bd.mp3
snares
toms
Code: Select all
<html>
<head><title>page</title>
</head>
<body>
<?php
$dir=opendir(".");
$files=array();
while (($file=readdir($dir)) !== false)
{
if ($file != "." and $file != ".." and $file != "index.php")
{
array_push($files, $file);
}
}
closedir($dir);
sort($files);
foreach ($files as $file)
print "<A href='$file'>$file</a>
<BR>";
?>
</body>
</html>