You are here: Re: readdir() doesn't maintain order « PHP Programming Language « IT news, forums, messages
Re: readdir() doesn't maintain order

Posted by Gordon Burditt on 09/15/07 17:40

>Was reviewing a few of the pages I made and something seemed odd.
>Further investigation showed that my thumbs are not in the order of the
>filesystem.

I believe that the order in which readdir() returns entries is *BY
DEFINITION* the order of the filesystem. If you want alphabetical
order or something else, sort it yourself.

>So it starts at pic 1370 and ends back at 1359. In reality the pics
>start at 1359 and end at 1424. Maybe the question is how is the file
>system really sorted?

It isn't.

>Using Filezilla it appears to be ascending by
>filename. Date and time of shots are ascending as this is all from the
>same "roll".

Many programs, like "ls" sort the file names for display purposes.
If you want a particular order (e.g. by name or file time or size),
sort it yourself. "ls -f" gives you unsorted output if your ls has
that option.

 

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

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