Hey everyone,
I am trying to write a script that goes through a certain directory and all its sub directories and have it return ONLY a list of FILES (not directories).
I have this working good so far for a single directory:
<?php
session_start();
?>
<html>
<head><title>page</title>
</head>
<body>
<?php
$dir=opendir("E:/DFS/Las_Vegas/intranet");
$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='http://lmtl-files/intranet/files/$file'>$file</a><br />";
?>
</body>
</html>
But I would like it to be able to scan all sub directories inside that directory and ONLY list files.
I would like to have 3 different sub directories:
intranet(parent directory)
IT (sub directory 1)
Accounting (sub directory 2)
Credit (sub directory 3)
I am trying to find a way to have it use the folder name as the title of the <ul> and then list its files right below it.
Anyone know a good way to go about this?