Solution Builder - Channel Insider
Empowering the next generation Channel
 

Sponsored Links
  • Get up and running in as quickly as 30 days with BI. Learn how today.
  • FREE Securing Smartphones & Tablets for Dummies Book from Sophos
  • 5 New Technologies That Will Change Enterprise ITAdvertisement
  • Build an IT Infrastructure That Delivers the Future

  •  

    Windows XP Changes Filename Sorting

    in Solution Builder



    Article Rating:starstarstarstarstar / 1
    Article Views: 3022

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

    Rate This Article:
    Add This Article To:

    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.




    comments dic


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


     



    channel chatter


    HTML PLAIN TEXT

    Keep on top of news for VARs and Resellers with CI's Weekly Newsletter and Alerts.


    [ci] feeds
    XML
    Add Channel News, Product Reviews, Trends and Analysis to your RSS newsreader or My Yahoo!


     


    CHANNEL SPONSORED RESOURCE CENTER
     
     
     
    Start the New Year with business intelligence—it’s a smart move
    Join us on February 1 for an encore rebroadcast at either 5 am or 12 noon EST and discover how business intelligence (BI) supports companies in uncertain business and economic climates. Get expert advice on how to create a strategy that fits your organization's needs and budget and see how quickly it can pay for itself.
    Click Here
     
    Security and Availability Essentials for Running Your Business in the Cloud
    Are you moving to the cloud? Find out what every IT professional should know about security and availability before moving to the cloud. Hear what a security provider’s own CSO has to say.
    Watch Video
    A new algorithm automatically identifies relationships between variables to help reduce researcher prejudice.
    Click HereAdvertisement