[Samba] directory list is not alphabetically sorted

Danilo Almeida dalmeida at centeris.com
Fri Sep 7 19:51:04 GMT 2007

Way back in June 2007, Jeremy wrote:
> On Thu, Jun 14, 2007 at 01:04:29PM -0400, Mark J. Reed wrote:
> > Am I to infer from this discussion that the Windows equivalent of
> > readdir() always returns its entries in sorted order?  Explorer and
> > CMD.EXE don't do that themselves?
> I think in Windows it does, but I don't think the clients depend
> on this (I vaguely recall a test that proved this was not mandatory...,
> can't remember the exact details though).
> Explorer and cmd.exe certainly do this - but I think the
> person with the problem is using OS/2 clients, which don't.

NTFS normally returns directly listings in sorted order (presumably because of the way the entries are stored).  However, FAT does not.  The order returned by a directory listing on Windows just depends on the FS implementation on Windows, just like on Unix.

cmd.exe dir does not sort by default (unless you do /on or set DIRCMD env var to include /on).  Explorer generally sorts by default.

- Danilo

More information about the samba mailing list