Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a folder in which I have created several subfolders, as follows:

  • v6.2
  • v6.25
  • v6.256
  • v6.3

When I view the contents in Windows Explorer, the items are displayed in a weird order (v6.3 should be the last), even if I clicked the Name column to sort it ascending:

enter image description here

Using dir in command prompt, or ls in Powershell, I get the expected order:

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----         1/15/2013  11:01 AM            v6.2
d----         1/15/2013  11:01 AM            v6.25
d----         1/15/2013  11:01 AM            v6.256
d----         1/15/2013  11:01 AM            v6.3

Sorting chronologically is not possible, because I may add v6.25 after v6.3, but still expect to see them ordered by name.

Does anyone know of a way to correctly sort the items in Windows Explorer?

share|improve this question
    
I've just tried this and it seems to be treating the part after the "." as a number so the sort order is "2", "3", "25", "256" which is correct. Even changing the "." to "_" doesn't change the behaviour. –  ChrisF Jan 15 '13 at 9:29
    
@Karan that's the answer I was looking for. Can you make your comment and answer so I can accept it? –  w0lf Jan 16 '13 at 7:41
1  
The numerical sorting makes it even harder to find anything when you have folders with GUIDs for names. –  kinokijuf Jan 16 '13 at 8:03

2 Answers 2

up vote 6 down vote accepted

As mentioned in this Microsoft KB article:

The sort order that is used by Windows Vista, Windows XP, and Windows Server 2003 for files and folders whose names contain numerals differs from the sort order that is used by Windows 2000.

By default, the newer sort order considers strings in file and folder names as numeric content, not text. Numerals in folder and file names are sorted according to their numeric value.

In the registry (Start / Run / regedit) you can add the NoStrCmpLogical DWORD value under

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Currentversion\Policies\Explorer

and set it to 1 to revert to the Windows 2000 non-numerical sorting style, or Enable the Turn off numerical sorting in Windows Explorer setting under

Computer Configuration / Administrative Templates / Windows Components / Windows Explorer

in the Local Group Policy Editor (via Start / Run / gpedit.msc, see here for more):

1

share|improve this answer

Pad with prepended 0's is the usual way to address an issue of this sort.

There is more information about Windows 7 sorting at http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-file-name-sort-order/b6bb0847-4b98-4f6b-85da-fe6b65516153 including:

“The problem is that there is no universal standard for sorting, and what works well in one situation for some people might not for others. Another recent poster expected 'ASCII sort order' - fair enough for English language, but what about other languages? ASCII sorts upper case letters ahead of lower case ones, and has some symbols before numbers, some after, some between Z and a and some after z. Would that poster really expect file names containing symbols to be sorted like that? (999).txt, [001].txt, {555}.txt? Charlie.txt, able.txt, baker.txt? It's a perennial problem, even requiring MS to assign two different language codes to Castilian Spanish according to whether the alphabet uses the traditional sort order or the modern one.

Two of your examples include spaces. Where should these fit into the sort order? Should 'nothing' always sort before 'something' or vice versa? If you replace the spaces in your examples with, for example, underscore characters, you will get a different result again.

MS Excel has, for good reasons, a well-defined sort order which anyone who uses that program will recognize. It's different from many others, and looks like this in English (the numbers are the ASCII code points):

SU536645 example

I guess that what I'm trying to say is you may have to adapt your filenames to suit the W7 sort order, rather than the other way round. I'm sure a lot of thought went into determining the order most likely to satisfy the majority of users (otherwise why would they have changed the system between Win2K and XP?). The main reason why I prefer the Win2K system is that it sorts hex numbers numerically; the XP system doesn't.

Apart from that, there are lots of situations where filenames including spaces are a nuisance, and sundry software will change those spaces to %20 or _ or something else.” (my emboldening)

and with reference to gpedit.msc “this method does not work with Windows 7”.

share|improve this answer
    
Yes, it solved the problem. Also, having v6.2.5 instead of v6.25 fixes the sort. –  w0lf Jan 15 '13 at 18:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.