« Rant: Most of us STILL Drive Cars | Main | Tight TAZ I Supposedly to Come with Removable Hard Drive »

December 15, 2003

Windows XP Directory Sorting: Bug or Feature?

I went slightly insane last night while trying to figure out why Windows was sorting some directories in a particular way. To illustrate, try this mental model:

Imagine two directories. One is named '09_temp' and '010_temp' is the name of the other. If the list of these two directories is sorted ascending by "name" (e.g., 'cat' would come before 'dog'), which directory would be listed first, 09_temp or 010_temp?

Well, I would have guessed 010_temp. Why? Well, the first character ('0') is the same for both dirs. The second character, however, is a '1' for one dir and a '9' for the other dir. When I was taught how to alphabetize things as a youth, I was told that '1' comes before '9'.

However, in the world of Windows, this ain't so. It seems that Windows has a bug (or a feature, depending on your point-of-view) that makes it treat directories and files that begin with numbers in a special way.

In the above examples, the dir named '09_temp' is viewed as beginning with the value 9 -- yes, 9, as in 1 greater than 8. Similarly, the other dir, 010_temp, is treated as if it begins with the value ten (yes, 10). So, in the above case, a value of 9 is less than a value of 10, so 09_temp would be listed above 010_temp when sorted alphanumerially ascending.

OK, is this documented somewhere..anywhere? Or, more to the point, what idiot at Microsoft thought that deviating from standard sorting precedence was a good idea? Jeez.

Follow-up: It seems that this practice is new for Windows XP (Windows 2000 uses common logic), and is documented in this MS Knowledge Base article. At least it's easy to change it...all I need to do is create a few registry keys, modify half a dozen settings, and reboot. Wow...how much more convenient could it be? </sarcasm>

Posted by Craig in Computing

Comments

After implementing the fix suggested by Microsoft, WinXP on my computer still sorts by treating sets of numerals as whole numbers. If anyone has another fix (short of changing OS's), please let me know...thanks.

Posted by: Craig at December 15, 2003 4:27 PM

It's working in my system after I changed the registry.

Posted by: Ken at December 17, 2003 12:50 AM

Post a comment



(will not be shown publicly)


(will be shown publicly)
Remember Me?

(you may use HTML tags for style)