I ran across an interesting “feature” of Windows today. Several other people have noticed this same behavior in Windows. This has apparently existed since Windows XP SP 1, and was changed after Windows 2000. Specifically, I ran into this issue when trying to find a file in a folder in which the file names were incremented hex named files. For example, you can download my example files or just create your own empty text files named similarly to the below, to reproduce this effect.

How I expected the files to be sorted, is in ASCII order, as it is when viewed via the “dir” command, or in the “ls” in Linux:

yanigisawa@chompers:~/Dropbox/test$ ls -l
total 0
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:49 00100.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:48 0010A.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:48 001A0.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:48 00A10.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:47 0101A.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:47 0A100.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:49 0A101.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 22:10 A001.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 22:09 A010.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 22:10 A100.txt
-rw-r--r-- 1 yanigisawa yanigisawa 0 2010-07-21 09:47 A101.txt

OR in the Linux PCmanFM file manager that is default in the CrunchBang Linux:

linuxSortOrder

However, in Windows, the files are ordered in a numerical order, when a number is contained within the file name:

WindowsSortedOrder

Though I don’t own a Mac, I had a friend test this there as well, and Mac OS 10 (I believe) also sorted these files the way that Windows did, that is, in numerical order, rather than ASCII order.

So, my choices are either:

1. When the file names contain numbers, expect the files to be sorted in numerical order, rather than ASCII order

2. OR, apply the registry fix mentioned in the knowledge base article I linked to earlier.

At this point, I decided to live with it, since I now at least understand why these files are sorted this way, even though I don’t really agree with it.