I can't believe I'm posting this :-p I'm nowhere near being a
unix/linux guru, and one would probably have a dozen complaints with
this if they saw it, but
ls -l | grep -v total | cut -f 11 -d ' ' | sort -n | tail -1
Your milage may vary if ls -l displays something slightly different than
Suppose I have a directory with a HUGE number of filenames, all of which
happen to look like integers:
~/nntp/1
~/nntp/2
~/nntp/3
.
.
.
~/nntp/59874
~/nntp/59875
~/nntp/59876
Now, in a PHP script, what's the most efficient way to find the "largest"
filename, where "largest" means in the sense of
Hi,
Wednesday, July 6, 2005, 2:43:38 PM, you wrote:
RL> Suppose I have a directory with a HUGE number of filenames, all of which
RL> happen to look like integers:
RL> ~/nntp/1
RL> ~/nntp/2
RL> ~/nntp/3
RL> .
RL> .
RL> .
RL> ~/nntp/59874
RL> ~/nntp/59875
RL> ~/nntp/59876
RL> Now, in a PHP script,
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
4 matches
Mail list logo