Strange sorting of directory names by Explorer

  • Thread starter Thread starter RichardOnRails
  • Start date Start date
R

RichardOnRails

Guest
Hi All,

Using Windows Explorer on WinXP/SP2, I created a bunch of
subdirectories in, say, C:\Temp\Topics, in the following order:

Original topics entered in the sequence shown
===============================
1First
2Second
3Third
4Fourth
21Second1
ZZZ
YYY

These names represent topics to be presented in a seminar.
"21Second1" represents an after-thought that is intended to follow
topic "2Second" after the Topics directory is sorted. The last two
were added just help analyze the anomaly I encounter when I click the
"Name" caption in Explorer twice, namely, that "21Second1" remains
behind "4Fourth". (Everything else looks fine to me)

Topics displayed in the sequence shown after clicking Name caption
twice
==================================================
1First
2Second
3Third
4Fourth
21Second1
YYY
ZZZ

I tested this in a Command Window with the DIR command and got::


Topics displayed in the sequence shown by the DIR command
==================================================
1First
21Second1
2Second
3Third
4Fourth
YYY
ZZZ


That seems exactly right to me, because the ASCII codes for digits are
smaller numbers than the codes for letters. (Once I understand what
Explorer is doing, I'll adopt conventions that work the way I wish.)

I thought the problem was that Explorer was sorting on "time created"
rather than name. That is refuted by the creation times of YYY and
ZZZ: 11:39 and 11:29 respectively.

FINAL TEST: I added a zero to "2Second" and got this:
Explorer
======
1First
3Third
4Fourth
20Second
21Second1
YYY
ZZZ

Command Window
=============
1First
20Second
21Second1
3Third
4Fourth
YYY
ZZZ

Could it be that Explorer parses initial digits from name and treats
them as number, where Command Window treats folder names as ASCII
strings, period?

Any insights?
--
Richard
 
Re: Strange sorting of directory names by Explorer

On Nov 17, 12:10 am, RichardOnRails
<RichardDummyMailbox58...@uscomputergurus.com> wrote:
> Hi All,
>
> Using Windows Explorer on WinXP/SP2, I created a bunch of
> subdirectories in, say, C:\Temp\Topics, in the following order:
>
> Original topics entered in the sequence shown
> ===============================
> 1First
> 2Second
> 3Third
> 4Fourth
> 21Second1
> ZZZ
> YYY
>
> These names represent topics to be presented in a seminar.
> "21Second1" represents an after-thought that is intended to follow
> topic "2Second" after the Topics directory is sorted. The last two
> were added just help analyze the anomaly I encounter when I click the
> "Name" caption in Explorer twice, namely, that "21Second1" remains
> behind "4Fourth". (Everything else looks fine to me)
>
> Topics displayed in the sequence shown after clicking Name caption
> twice
> ==================================================
> 1First
> 2Second
> 3Third
> 4Fourth
> 21Second1
> YYY
> ZZZ
>
> I tested this in a Command Window with the DIR command and got::
>
> Topics displayed in the sequence shown by the DIR command
> ==================================================
> 1First
> 21Second1
> 2Second
> 3Third
> 4Fourth
> YYY
> ZZZ
>
> That seems exactly right to me, because the ASCII codes for digits are
> smaller numbers than the codes for letters. (Once I understand what
> Explorer is doing, I'll adopt conventions that work the way I wish.)
>
> I thought the problem was that Explorer was sorting on "time created"
> rather than name. That is refuted by the creation times of YYY and
> ZZZ: 11:39 and 11:29 respectively.
>
> FINAL TEST: I added a zero to "2Second" and got this:
> Explorer
> ======
> 1First
> 3Third
> 4Fourth
> 20Second
> 21Second1
> YYY
> ZZZ
>
> Command Window
> =============
> 1First
> 20Second
> 21Second1
> 3Third
> 4Fourth
> YYY
> ZZZ
>
> Could it be that Explorer parses initial digits from name and treats
> them as number, where Command Window treats folder names as ASCII
> strings, period?
>
> Any insights?
> --
> Richard


I think the following proves my final hypothesis: Explorer strips off
initial digits and treats them as the primary key; Explorer treats
the remainder as a secondary key.

Explorer sorted result for following items,
regardless of order of entry:
====================

1First
2.0Second
2.1Second1
3Third
4Fourth
11AAA
11Eleven
12Twelve

DOS sort result:
===========
11AAA
11Eleven
12Twelve
1First
2.0Second
2.1Second1
3Third
4Fourth

QED??
--
Richard
 
Re: Strange sorting of directory names by Explorer

RichardOnRails wrote:
> On Nov 17, 12:10 am, RichardOnRails
> <RichardDummyMailbox58...@uscomputergurus.com> wrote:
>> Hi All,
>>
>> Using Windows Explorer on WinXP/SP2, I created a bunch of
>> subdirectories in, say, C:\Temp\Topics, in the following order:
>>
>> Original topics entered in the sequence shown
>> ===============================
>> 1First
>> 2Second
>> 3Third
>> 4Fourth
>> 21Second1
>> ZZZ
>> YYY
>>
>> These names represent topics to be presented in a seminar.
>> "21Second1" represents an after-thought that is intended to follow
>> topic "2Second" after the Topics directory is sorted. The last two
>> were added just help analyze the anomaly I encounter when I click the
>> "Name" caption in Explorer twice, namely, that "21Second1" remains
>> behind "4Fourth". (Everything else looks fine to me)
>>
>> Topics displayed in the sequence shown after clicking Name caption
>> twice
>> ==================================================
>> 1First
>> 2Second
>> 3Third
>> 4Fourth
>> 21Second1
>> YYY
>> ZZZ
>>
>> I tested this in a Command Window with the DIR command and got::
>>
>> Topics displayed in the sequence shown by the DIR command
>> ==================================================
>> 1First
>> 21Second1
>> 2Second
>> 3Third
>> 4Fourth
>> YYY
>> ZZZ
>>
>> That seems exactly right to me, because the ASCII codes for digits are
>> smaller numbers than the codes for letters. (Once I understand what
>> Explorer is doing, I'll adopt conventions that work the way I wish.)
>>
>> I thought the problem was that Explorer was sorting on "time created"
>> rather than name. That is refuted by the creation times of YYY and
>> ZZZ: 11:39 and 11:29 respectively.
>>
>> FINAL TEST: I added a zero to "2Second" and got this:
>> Explorer
>> ======
>> 1First
>> 3Third
>> 4Fourth
>> 20Second
>> 21Second1
>> YYY
>> ZZZ
>>
>> Command Window
>> =============
>> 1First
>> 20Second
>> 21Second1
>> 3Third
>> 4Fourth
>> YYY
>> ZZZ
>>
>> Could it be that Explorer parses initial digits from name and treats
>> them as number, where Command Window treats folder names as ASCII
>> strings, period?
>>
>> Any insights?

>
> QED??


http://www.kellys-korner-xp.com/xp_tweaks.htm
Line 19. (r-h column) Correct the Sort Order in Windows XP

--
Joe =o)
 
Re: Strange sorting of directory names by Explorer

On Nov 17, 8:19 am, Elmo <elmog...@iglou.invalid> wrote:
> RichardOnRails wrote:
> > On Nov 17, 12:10 am, RichardOnRails
> > <RichardDummyMailbox58...@uscomputergurus.com> wrote:
> >> Hi All,

>
> >> Using Windows Explorer on WinXP/SP2, I created a bunch of
> >> subdirectories in, say, C:\Temp\Topics, in the following order:

>
> >> Original topics entered in the sequence shown
> >> ===============================
> >> 1First
> >> 2Second
> >> 3Third
> >> 4Fourth
> >> 21Second1
> >> ZZZ
> >> YYY

>
> >> These names represent topics to be presented in a seminar.
> >> "21Second1" represents an after-thought that is intended to follow
> >> topic "2Second" after the Topics directory is sorted. The last two
> >> were added just help analyze the anomaly I encounter when I click the
> >> "Name" caption in Explorer twice, namely, that "21Second1" remains
> >> behind "4Fourth". (Everything else looks fine to me)

>
> >> Topics displayed in the sequence shown after clicking Name caption
> >> twice
> >> ==================================================
> >> 1First
> >> 2Second
> >> 3Third
> >> 4Fourth
> >> 21Second1
> >> YYY
> >> ZZZ

>
> >> I tested this in a Command Window with the DIR command and got::

>
> >> Topics displayed in the sequence shown by the DIR command
> >> ==================================================
> >> 1First
> >> 21Second1
> >> 2Second
> >> 3Third
> >> 4Fourth
> >> YYY
> >> ZZZ

>
> >> That seems exactly right to me, because the ASCII codes for digits are
> >> smaller numbers than the codes for letters. (Once I understand what
> >> Explorer is doing, I'll adopt conventions that work the way I wish.)

>
> >> I thought the problem was that Explorer was sorting on "time created"
> >> rather than name. That is refuted by the creation times of YYY and
> >> ZZZ: 11:39 and 11:29 respectively.

>
> >> FINAL TEST: I added a zero to "2Second" and got this:
> >> Explorer
> >> ======
> >> 1First
> >> 3Third
> >> 4Fourth
> >> 20Second
> >> 21Second1
> >> YYY
> >> ZZZ

>
> >> Command Window
> >> =============
> >> 1First
> >> 20Second
> >> 21Second1
> >> 3Third
> >> 4Fourth
> >> YYY
> >> ZZZ

>
> >> Could it be that Explorer parses initial digits from name and treats
> >> them as number, where Command Window treats folder names as ASCII
> >> strings, period?

>
> >> Any insights?

>
> > QED??

>
> http://www.kellys-korner-xp.com/xp_tweaks.htm
> Line 19. (r-h column) Correct the Sort Order in Windows XP
>
> --
> Joe =o)


Hi Joe,

Thanks for ...
> http://www.kellys-korner-xp.com/xp_tweaks.htm
> Line 19. (r-h column) Correct the Sort Order in Windows XP


That's a good site to know about. (Actually, the top page,
http://www.kellys-korner.com/, is worth a look. too.)

But further experimentation has led me to realize that the default
registry settings which I have on my machine lead Windows Explorer to
provide Dewey Decimal sorting on the names of sub-directories. That's
perfect for my application in which I want to created a hierarchy of
topics, sub-topics and maybe even sub-sub-topics. I need to be able
to insert new topics at the logically appropriate places in the
hierarchy. This Explorer feature lets me do that painlessly.

Furthermore, I can use a regular expression to retrieve those names
and preserver their order during creation of HTML anchor statements.

I had often been irked in the past by what I then thought was weird
behavior by Explorer. Now I discover it's a virtue.

Best wishes,
Richard
 
Back
Top