file list and linking...

From: Date: Wed, 20 Dec 2000 04:58:59 +0000
Subject: file list and linking...
Groups: php.general 
Request: Send a blank email to php-general+get-31152@lists.php.net to get a copy of this message
Working on a script to list files in the folder of the file and all the subdirs in it ...but I have no idea how to make it so that each file that it brings up is linked (and with the actual http://..... instead of the /WWW/clients/ part) any help would be greatly appreciated. <?php $basedir = "/WWW/clients/tinseland.qpalzm.com/music/"; function listall($dir) { $dir_files = $dir_subdirs = array(); print( "<br><br><b>$dir</b><br>\n"); chdir($dir); $handle = @opendir($dir) or die( "Directory \"$dir\"not found."); while($entry = readdir($handle)) { if(is_dir($entry) && $entry != ".." && $entry != ".") { $dir_subdirs[] = $entry; } elseif($entry != ".." && $entry != ".") { $dir_files[] = $entry; } } sort($dir_files); sort($dir_subdirs); for($i=0; $i<count($dir_files); $i++) { print( "$dir_files[$i]<br>\n"); } for($i=0; $i<count($dir_subdirs); $i++) { listall( "$dir$dir_subdirs[$i]/"); } closedir($handle); } listall($basedir); ?> What I have so far is shown here: http://tinseland.qpalzm.com/music/music.php Thanks, Doug

« previous php.general (#31152) next »