October 25, 2012 Sort order of dirEntries | ||||
---|---|---|---|---|
| ||||
Hello all, I've just been playing with dirEntries and by the looks of it, it returns these entries in arbitrary order. Is there a way to get it to sort the entries in alphabetical order, other than the obvious one of storing them in an array and sorting that? (This is untenable because I'm talking about a lot of files...:-) Thanks and best wishes, -- Joe |
October 26, 2012 Re: Sort order of dirEntries | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On Thu, 25 Oct 2012 01:15:06 +0100, Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> wrote: > Hello all, > > I've just been playing with dirEntries and by the looks of it, it returns these entries in arbitrary order. On windows, assuming it was using FindFirstFile or similar you would get alphabetical order on some platforms/file systems and FAT table order on others. I imagine linux and associated platforms have similar behaviour. > Is there a way to get it to sort the entries in alphabetical order, other than the obvious one of storing them in an array and sorting that? (This is untenable because I'm talking about a lot of files...:-) To get a sorted list someone has to load all the entries and sort them. I doubt the file system is going to do it, so either the library routine would have to, or you're going to have to. As most file systems and libraries should take the most efficient approach first and foremost it's likely you're going to have to do it yourself. :) R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
Copyright © 1999-2021 by the D Language Foundation