Hi
I need someone to write me a script that reads the contents of a folder and its subfolders and then write the content into a html file as a list of links.
I would need it asap.
If someone is interested please give me a quotation.
Thanks
Ute
Help needed
Moderator: General Moderators
- MindOverBody
- Forum Commoner
- Posts: 96
- Joined: Fri Aug 06, 2010 9:01 pm
- Location: Osijek, Croatia
Re: Help needed
Here it is, play a bit, and adjust it to your needs
Code: Select all
function getDirTree( $RootPath, $Position ){
if ( ( $directoryHandle = opendir( $RootPath ) ) == true ) {
$Position += 15;
while ( ( $file = readdir( $directoryHandle ) ) !== false ) {
if ( is_dir( $RootPath . "/" . $file ) && ( $file == '.' || $file == '..' ) !== true ){
echo "<div style='margin-left: " . $Position . "px; '> » <a href='" . $RootPath . "/" . $file . "'>" . $file . "</a></div>";
getDirTree( $RootPath . "/" . $file, $Position );
}
}
}
}
// First parameter: Starting position
// Second parameter: Tree item left margin (in pixels)
getDirTree( dirname(__file__), -15 );