Option 1: read the dir then if its a directory search inside it and execute script (to write files to a txt file), else execute script and then repeat until folder is done.
Option 2: read the dir and store all the folder names as variables and record how many ie
Code: Select all
$folder1 = a_folder, $folder2 = another_folder, $total = 2I dont really care which way, any will do although most efficient would be nice.
This is what Ive got so far:
Code: Select all
<?php
if ($handle = opendir('files/folder')) {
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$thelist .= '<a href="files/folder/'.$file.'">'.$file.'</a>'.'<br>';
}
}
closedir($handle);
}
?>
Folder added<br>
<?php
$fh = fopen("main/lists/folder/files.php", "w+");
fwrite($fh, $thelist);
fclose($fh);
?>
<?php
$thelist = '';
?>
Can anyone help?