Richard Lynch wrote: > Suppose I have a directory with a HUGE number of filenames, all of > which happen to look like integers: [...] > Now, in a PHP script, what's the most efficient way to find the > "largest" filename, where "largest" means in the sense of an integer, > not a string? [...] > Is there some nifty shell command I should just "exec"?... How about this: $output = exec("cd $myDirectory; ls -C -1 | sort -n -r | head -n1"); That's assuming your version of "ls" supports the -C (list entries by column) and -1 (list one file per line) options. Mine does (Debian stable) but if you're using a different *nix it may not. HTH... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php