You are here: Find largest integer filename « PHP « IT news, forums, messages
Find largest integer filename

Posted by "Richard Lynch" on 07/06/05 07:43

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 an integer, not a string?

I could probably force the filenames to be 0-padded if that would make a
significant difference.

Is there some nifty shell command I should just "exec"?...

I don't really care which shell, but I'm a bash user generally.

Obviously I could loop through all the filenames, so I'm looking for
something faster than that. :-)

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация