Jump to content

Recommended Posts

Posted

I have just found a strange sorting behavior in the Windows Explorer of WinXP SP2 Home.

The sorting is wrong when applied to filename starting with numerals, for example when sorting ascending 4 files in a folder, the result is as follows:

2test.txt

10test.txt

stest.txt

test.txt

As you can see, the file <2test.txt> comes before <10test.txt>, simply because the filename length of <2test.txt> is shorter than the filename length of <10test.txt>, it should be the other way around.

But when it comes to the filename starting with alphabets, it behaves correctly, in the example above even though the filename length of <stest.txt> is greater than <test.txt>, <stest.txt> still is displayed before <test.txt>, which is correct.

Does someone know what is causing that? Is there a way to fix it?

Thanks a lot.


Posted

Windows is trying to be clever. It sees numbers at the start, and sorts based on the whole number. i.e. it puts 2 first, then 10, then the letters. If you put 22test.txt, it will be 2, then 10, then 22. It's nothing to do with the actual length of the whole filename.

You can fiddle with the sorting method a bit:

"The sort order for files and folders whose names contain numerals is different in Windows XP than it is in Windows 2000"

http://support.microsoft.com/kb/319827

Posted

Thanks to SmaugyGrrr for the hint on this matter.

I have taken a look at KB319827, and realized that WinXP does the sorting differently.

Following is an example in that KB for the XP sorting behavior:

Ie4_01

Ie4_128

Ie5

Ie6

Ie401sp2

Ie501sp2

We can see that the same group of IE4, i.e., Ie4_01, Ie4_128 and Ie401sp2 are separated, so is IE5 too.

Whereas Win2K does it like this:

Ie4_01

Ie4_128

Ie401sp2

Ie5

Ie501sp2

Ie6

Here all IE4 are grouped together.

I personally prefer the Win2K sorting behavior.

Luckily KB319827 also describes Registry patch that brings back the Win2K behavior.

I did it right away.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...