Google Answers Logo
View Question
 
Q: Windows XP file sorting order ( No Answer,   1 Comment )
Question  
Subject: Windows XP file sorting order
Category: Computers > Operating Systems
Asked by: rmcclure-ga
List Price: $40.00
Posted: 12 Nov 2005 22:21 PST
Expires: 12 Dec 2005 22:21 PST
Question ID: 592400
Hi there,
  I'm currently writing a Java slideshow application to replace the
default image-viewing program in Windows.  I want this program to sort
files the same way that Windows does, but I'm finding that emulating
this behavior is extraordinarily tricky, especially when one takes
miscellaneous symbols into account.  Can you provide the precise
methodology Windows uses to sort its files?  I only need the "by-name"
sorting process, as the other sorts are straightforward.

Here's what I already know:
* Upper-case letters are treated the same as lower-case.
* Numbers in filenames are sorted numerically, not alphabetically
(e.g. a9.txt comes before a10.txt).
* Ascii symbols are NOT sorted in ascii order, and in fact this order
CHANGES depending on where in the filename the symbols exist!  When
the symbols appear at the beginning of the filename, the sorting order
seems to be:
[space] ! # $ % & ( ) , . ; @ [ ] _ ' - ` { } ~ + =
though I could be mistaken on one or two of these, as I gave up in
frustration during this process. =) Again, this only applies when
these characters are at the head of the file and are thus being sorted
on their own; once you embed them into alphanumeric strings everything
goes haywire.  Example: "aab.txt" < "-ab.txt" < "a-b.txt" !!! 
Seriously, try it out.  It's insane.

At this point it seems like I'd have to put in hours of work
generating every possible permutation to get the ordering right, and I
really don't want to do that; but on the other hand, I'm so obsessed
with this problem now that I don't think I'm going to get any sleep
without having asked someone about it.  Please help!

Clarification of Question by rmcclure-ga on 15 Nov 2005 18:09 PST
In order to forstall any further dead-end answers, please note that
the implementation provided by Vasian Cepa (located at
http://www.codeproject.com/csharp/csnsort.asp?df=100&forumid=199676&select=1177161
) DOES NOT take into account the strange behavior Windows exhibits
when sorting non-alphanumeric characters, and in fact makes an
incorrect assertion when claiming that Windows only sorts these
characters differently at the head of a string.  This page should not
be used as a resource in providing an answer.

Thanks,
Ross McClure
Answer  
There is no answer at this time.

Comments  
Subject: Re: Windows XP file sorting order
From: mb200-ga on 18 Nov 2005 08:22 PST
 
Please write at peter_s_2000 (at) yahoo.com for a reply.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy