04-08-2009, 05:49 PM
|
#2 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Here, I fixed it for you. I tested this on my /etc/ntp/ directory so just change it to whatever yours is.
Code:
<?php
$directory = "/etc/ntp/";
function dirList ($directory)
{
$directory_link = "/etc/ntp/";
// create an array to hold directory list
$results = array();
// create a handler for the directory
$handler = opendir($directory);
// keep going until all files in directory have been read
while ($file = readdir($handler)) {
$file = "$directory_link" . $file;
$level1 = "$directory_link" . '.';
$level2 = "$directory_link" . '..';
// if $file isn't this directory or its parent,
// add it to the results array
if ($file != "$level1" && $file != "$level2")
// If file is directory, mark it in bold.
if (is_dir($file) == TRUE){
print "<b>$file</b><br/>";
// Else not styled
}else{
print "$file<br/>";
}
}
// Here probably should be my code for sorting the folder on top of the files.
// tidy up: close the handler
closedir($handler);
// done!
return $results;
}
dirList($directory);
?>
/etc/ntp/ntp2
/etc/ntp/step-tickers
/etc/ntp/keys
/etc/ntp/ntpservers
|
|
|
|