Microsoft

How to alter File Explorer's default sort

Microsoft deliberately changed the default sorting algorithm, starting with Windows XP. Find out how you can revert back to the old time sorting algorithm.

Windows

Soon after the article "Get your bit together with File Explorer's Group by feature in Windows 8.x," which showed you how to use File Explorer's Group by feature to sort your data, I received an email message from a user who wondered if I knew why every version of Windows after Windows 2000 used what he called a "bass ackwards" sorting algorithm for file and folder names that contain numbers. He went on to explain via an example in which he showed how the default sorting algorithm in Windows Explorer changed after Windows 2000. (To make the difference more apparent, I've come up with a more detailed example.)

In Windows 2000, and previous versions of Windows, if you had six files named Sort 1.rtf, Sort 2.rtf, Sort 3.rtf, Sort 22.rtf, Sort 111.rtf, and Sort 3333, they would appear in Windows Explorer's ascending sort as shown in Figure A.

Figure A

Figure A

In Windows 2000 and earlier, the example files are sorted in this fashion.

However, starting with Windows XP and continuing all the way to Windows 8.1, these same files would appear in Windows/File Explorer's ascending sort as shown in Figure B.

Figure B

Figure B

In Windows XP and above, the example files are sorted in this fashion.

The same goes for similarly named folders, he added. He then went on to say that over the many years of using Windows XP, he has simply adapted and forgot all about it. But after getting a new computer with Windows 8.1, and then reading my article about using the Group by feature, his old question resurfaced.

After doing some research, I discovered that Microsoft did indeed deliberately change the default sorting algorithm, starting with Windows XP. I also discovered that they provided you with a way to revert back to the old time sorting algorithm.

In this article, I'll tell you what I learned and show you how to perform the conversion in Windows 8.x using either the Local Group Policy Editor or by editing the registry. (While I'll use Windows 8.x as my example, the same technique can be applied in Windows XP, Windows Vista, and Windows 7.)

Literal vs. numerical

Let's begin by taking a look at these sorting systems, which are called Literal and Numerical. In Windows 2000 and earlier, Microsoft used a sorting algorithm in which file and folder names were sorted literally in Windows Explorer. In Windows XP, Microsoft decided to alter the sorting algorithm. Since then, Microsoft has used a sorting algorithm in which file and folder names are sorted numerically in Windows/File Explorer.

As you can see in Figure A, in the literal sorting system, files whose names include numbers are arranged by each digit in the filename. Since 1 comes before 2, 111 comes before 22. In the numerical sorting system, shown in Figure B, the files whose names include numbers are arranged in increasing numerical values, thus 22 comes before 111.

Which one is better?

When you think about it, each one of these sorting systems makes sense. The one that you like will depend on how you name your files and how you like to have them arranged in Windows/File Explorer.

Of course, since we have been using the numerical sorting system for so long, you may not even care about the old literal sorting system. If so, you can stop reading right now. However, if you would like to experiment, read on. As you do, keep in mind that you can always switch back by simply undoing the changes we are about to look at.

Make a backup

Just to be on the safe side, you should make a backup of your system, especially if you are going to be using the registry edit method. If you want to have a full backup on hand, check out the article "Restore Windows 8 with System Image Recovery," where I showed you how to create a system image. If you already have a current system image, you may simply want to create a restore point as I showed you in the article, "Use System Restore as a recovery tool in Windows 8." Of course, you could do both.

Performing the conversion

If you have Windows 8.x Professional/Enterprise, you can make the change with the Local Group Policy Editor. If you have one of the other versions of Windows 8.x, you can make the change by editing the registry.

Using the Local Group Policy Editor

If you have access to the Local Group Policy Editor, you can use it to make the change. To begin, just press [Windows]+[R] to bring up the run dialog box. Then, type gpedit.msc in the Open text box, and click OK.

In a moment, the Local Group Policy Editor window will appear on the screen. Now, navigate down the Local Computer Policy tree using the following path:

Computer Configuration | Administrative Templates | Windows Components | File Explorer

When you open the File Explorer folder, as shown in Figure C, locate and double-click the Turn off numerical sorting in File Explorer option.

Figure C

Figure C

You can easily revert to the literal sorting system using the Local Group Policy Editor.

When you do, you'll see the Turn off numerical sorting in File Explorer dialog box. To continue, select Enabled, as shown in Figure D.

Figure D

Figure D

Select Enabled to turn off numerical sorting.

At this point, click OK and then close the Local Group Policy Editor window. You'll then need to Sign out and then Sign in again. You don't need to restart to activate the change, although you can if you want.

To return to the numerical sorting system, just change the Turn off numerical sorting in File Explorer setting to Disabled.

Editing the registry

Making the change by editing the registry is pretty straightforward. To begin, launch the Registry Editor by pressing [Windows]+[R] to access the Run dialog box. Then, type regedit in the open text box, and click OK. Of course, you'll have to deal with the UAC. Then, open the following subkeys:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer

When you access the Explorer subkey, right-click in the right panel and select the New | DWORD command. When the new value appears, name it NoStrCmpLogical. Then, double-click the new NoStrCmpLogical value and set the Value data to 1, as shown in Figure E. To put the new setting into action, click OK, close the Registry Editor, and restart your system.

Figure E

Figure E

Set the value data to 1.

To return to the numerical sorting system, just change the NoStrCmpLogical value back to 0.

What's your take?

Have you missed the old literal file sorting system? If so, will you revert back using this technique? As always, if you have comments or information to share about this topic, please take a moment to join in the discussion thread below.

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks

Free Newsletters, In your Inbox