Solution Builder - Channel Insider
 
 

Windows XP Changes Filename Sorting


Article Rating:starstarstarstarstar / 0

Rate This Article:
Add This Article To:
Here's a fix if Win XP's new (and dramatically different) file-sorting algorithm wreaks havoc on legacy programs.

Microsoft changed the filename sort algorithm in Windows XP, making it different from all previous versions. The only reference I've found is the Microsoft Knowledge Base Article Q318872 that addresses an incorrect sort order in Windows XP. This article in turn refers to a new Windows API function called StrCmpLogicalW, which implements the new sort algorithm.

I have almost 5,000 filenames that were constructed so that Windows Explorer would sort the filenames chronologically (using the old character-by-character sort algorithm). These files have been distributed across the United States. I now have the task of renaming all these files so that Windows XP will sort them chronologically and still have them sort correctly in previous Windows versions.

There is a small Registry fix that will restore the old sort order, but I can't rely on all my users installing this fix. I want to bring this to the attention of computer users. As users develop program tasks that require filename sorts, they need to be aware of this unpublicized Microsoft change that will directly impact their desired end results.

Fred Gould

There are actually two distinct points here. First, Windows XP has a new sorting algorithm for filenames. Second, this algorithm may break down when filenames contain ten or more consecutive digits. The problem with long strings of digits has been fixed in the latest Windows XP service pack, but the change to the sort algorithm remains.

In previous versions of Windows, filenames are sorted text-wise, character by character. File1.txt, File10.txt, and File100.txt are all placed before File2.txt, because the digit 1 comes before the digit 2. Most users have grown accustomed to zero-padding sequential numbers in filenames—File010.txt correctly comes after File002.txt. Under Windows XP, though, each block of consecutive digits is treated as a number and sorted as such. Even without zero-padding, File10.txt comes after File2.txt.

For most users, this will be a benefit, not a problem. If you're one of the few who have developed solutions that rely on the old order, you can make the Registry tweak mentioned above. Launch REGEDIT from the Start menu's Run dialog and navigate to HKEY_LOCAL_ MACHINE\Software\Microsoft\Windows\ Currentversion\Policies\Explorer. In the right-hand pane, find or create a DWORD value named NoStrCmpLogical. Double-click it and set its data to 1 (no matter whether it's hex or decimal). Now Win XP will sort filenames the old way.





Discuss Windows XP Changes Filename Sorting
 
>>> Be the FIRST to comment on this article!
 

 
 
>>> More Solution Builder Articles          >>> More By Neil J. Rubenking
 


 

Vizard: IBM Gets Principled About the Channel
Big Blue looks to improve its reputation with a Principles of Engagement document governing how internal salespeople deal with the channel.

CHANNEL DEEP DIVES
CareersLinux and Unix
Computer NetworkingPrinters
SecuritySMB Partner
StorageSurveys
Solution BuilderMessaging/Collaboration
Dell ResellersMicrosoft Partners

SIGN UP FOR CHANNEL INSIDER NEWSLETTERS
Reliable, timely information on the business of technology. Sign up now.


 

CHANNEL RESOURCE CENTER
HP StorageWorks Scalable NAS is highly available, scalable network-attached storage for any industry solution. To learn how you can take full advantage of fault-tolerant NAS that seamlessly scales capacity and performance, visit: http://www.hp.com/go/scalablenas


Feature Video: What Can Green Do For You?
There are many ways that systems can be run faster or more efficiently, using less energy and thereby reducing costs. Watch now!
Microsoft-hosted solution offers you advanced customer relationship management capabilities without a major investment in IT and staffing.
Try It for free for 30 days!