Wijono Posted July 24, 2007 Posted July 24, 2007 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.txt10test.txtstest.txttest.txtAs 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.
SmaugyGrrr Posted July 24, 2007 Posted July 24, 2007 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
Wijono Posted July 25, 2007 Author Posted July 25, 2007 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_01Ie4_128Ie5Ie6Ie401sp2Ie501sp2We 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_01Ie4_128Ie401sp2Ie5Ie501sp2Ie6Here 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now