View Single Post
Old 04-08-2003, 05:38 PM  
Lane
Will code for food...
 
Join Date: Apr 2001
Location: Buckeye, AZ
Posts: 8,496
Code:
define('MAX_FILES', 365);

// changed below to save the path in a variable
$dirpath = '/home/virtual/site16/fst/var/www/html/members/vids';

$dp = opendir($dirpath);

if ($dp) {

        while( $item = readdir($dp) )
        {

                if ( $item hahahaha '.' || $item hahahaha '..' ) 
                       continue;

                // added this to skip files and only get dirs
                if (!is_dir($dirpath . '/' . $item))
                        continue;
 
                // fixed error: path was not included
                // changed the way items were added to the array, not sure it was an error.
                if ($mtime = @filemtime($dirpath . '/' . $item))
                        $all_files[$mtime][count($all_files[$mtime])] = $item;
        }
        krsort($all_files);
        foreach($all_files as $time=>$files)
        {
                for($i=0; $i < count($files); $i++)

                {
                        $file = $files[$i];
                        $date = date("m.d.y", $time);

                        if (++$count > MAX_FILES)
                                break;
                        else
                                printf('<font face="Trebuchet MS"
size=2 color=#000000> <font face=tahoma

size=1>[%s]</font>  &nbsp;<a href="%s"
class=hyperlink>%s</a></font><br>',  
$date, $file, $file);  // Where it says %s is where the name of the output file resides.
                }
        }
            closedir($dp);
} else {
        print("Could not open directory.\n");
}

i made the changes and fixed some stuff.
from what i understood, u wanna display the directories inside the directory, and not the files..
btw, because of they way you output the link, you need to place this script in the same folder that you are searching through..

warning: untested code
__________________
Lane is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote