I'm able to print a directory with opendir, but currently the files are in random order.

My goal is to determine a way to use passthru (or some similar function... exex or system maybe) to sort the directory prior to listing it on the screen. I want to use opendir so I can make a link to the files (otherwise a simple <pre></pre> output would do nicely).

Am I barking up the wrong tree, or can this be accomplished?

If so, where do I put the passthrough command in the context of this:

Code:
	$path = '/var/www/html/files/';
	$dir_handle = opendir($path) or die("Unable to open $path");
	while ($file = readdir($dir_handle)) {
		$filedate = filectime("$path$file"); 
		$filedate = date("m/d/Y G:i:s", $filedate); 
		$file_size = filesize("$path$file"); 
		echo "<a href='http:///files/$file' target=new>$file</a><br>";
	}
Thanks!