Sorting files in a different order than alphabetical

C

ccdhofer

I'm wondering if there is a way to sort files within a folder by file name
other than alphabetical/numerical. My dilemma is that I will have folders
that will have 4 digit numbers that will be always preceeded by an "S" or a
"K". The numbers will also be followed by various letters, starting at
A,B,C, on and so on. For instance, examples of files would look like this:
S7054A; S7054B; S7054C; K7055A; K7055B;
S7056A..... I would like to have the actual 4 digit number (not including
the prefix letter) in numerical order, as shown in the example. If I sort by
name alone, it puts all of the "K" files first in numerical order, and then
the "S" files in numerical order after that. In essence, I would like the
files sorted numerically by the SECOND character in the file name. IS there
a way to do this? I will have MANY folders that will contain files such as
these. I am using Windows XP professional 2002.
 
B

BillW50

In ccdhofer typed onn Thu, 19 Mar 2009 08:50:11 -0700:
I'm wondering if there is a way to sort files within a folder by file
name other than alphabetical/numerical. My dilemma is that I will
have folders that will have 4 digit numbers that will be always
preceeded by an "S" or a "K". The numbers will also be followed by
various letters, starting at A,B,C, on and so on. For instance,
examples of files would look like this: S7054A; S7054B; S7054C;
K7055A; K7055B;
S7056A..... I would like to have the actual 4 digit number (not
including the prefix letter) in numerical order, as shown in the
example. If I sort by name alone, it puts all of the "K" files first
in numerical order, and then the "S" files in numerical order after
that. In essence, I would like the files sorted numerically by the
SECOND character in the file name. IS there a way to do this? I
will have MANY folders that will contain files such as these. I am
using Windows XP professional 2002.

Sure there is always a way to do it. Although what program are you using
to sort? DIR, Windows Explorer, etc. Might have to write a script to
pull it off. Another idea is to use Bulk Rename (free) will easily
rename all of your filenames in no time flat to your liking.
 
K

Kelly

After doing some research, I find this is because in Windows XP, any
numeric string is handled as a number, instead of sorting character by
character in the filename. So in your example, 000 equals 0. This is
actually a more logical way to sort when it comes to numeric strings - if
you create folders "1" thru "10" under Win2K, 10 will actually come between
1 and 2. On XP, it will sort "correctly" - ie, 10 comes after 9.

You can modify this behavior by modifying the following regsitry value:

Key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Currentversion\Policies\Explorer.

Value Name: NoStrCmpLogical
Value Type: REG_DWORD
Value Data:
NoStrCmpLogical = 0 (default behavior in Windows XP)
NoStrCmpLogical = 1 (win2k behavior)

Incorrect Sort Order in Windows Explorer in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q318872

The sorting method is changed in Windows XP. The method that is used for
sorting is described at the following MSDN Web site: StrCmpLogicalW Function

Change the Sort Order Back to W2K Style (Line 107)
http://www.kellys-korner-xp.com/xp_tweaks.htm

To use the Regedit: Save the REG File to your hard disk. Double click it
and answer yes to the import prompt. REG files can be viewed in Notepad by
right clicking on the file and selecting Edit.

Added info:

Sort All by Alphabet - Start Menu and Fav's (Line 196)
http://www.kellys-korner-xp.com/xp_tweaks.htm

--

All the Best,
Kelly (MS-MVP/DTS&XP)

Taskbar Repair Tool Plus!
http://www.kellys-korner-xp.com/taskbarplus!.htm
 
C

ccdhofer

I use Windows Explorer to view and find files - this is where I would like
them sorted by second character - and I'm very much a novice computer user,
so I don't know too much about technical terms and inner workings of a
computer!!!
 
T

Terry R.

The date and time was Thursday, March 19, 2009 9:11:44 AM, and on a
whim, Kelly pounded out on the keyboard:
After doing some research, I find this is because in Windows XP, any
numeric string is handled as a number, instead of sorting character by
character in the filename. So in your example, 000 equals 0. This is
actually a more logical way to sort when it comes to numeric strings - if
you create folders "1" thru "10" under Win2K, 10 will actually come between
1 and 2. On XP, it will sort "correctly" - ie, 10 comes after 9.

You can modify this behavior by modifying the following regsitry value:

Key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Currentversion\Policies\Explorer.

Value Name: NoStrCmpLogical
Value Type: REG_DWORD
Value Data:
NoStrCmpLogical = 0 (default behavior in Windows XP)
NoStrCmpLogical = 1 (win2k behavior)

Incorrect Sort Order in Windows Explorer in Windows XP
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q318872

The sorting method is changed in Windows XP. The method that is used for
sorting is described at the following MSDN Web site: StrCmpLogicalW Function

Change the Sort Order Back to W2K Style (Line 107)
http://www.kellys-korner-xp.com/xp_tweaks.htm

To use the Regedit: Save the REG File to your hard disk. Double click it
and answer yes to the import prompt. REG files can be viewed in Notepad by
right clicking on the file and selecting Edit.

Added info:

Sort All by Alphabet - Start Menu and Fav's (Line 196)
http://www.kellys-korner-xp.com/xp_tweaks.htm

Hi Kelly,

But will this assist the OP? They want to sort by 2nd character
(numeric), and the first character is a letter.


Terry R.
 
D

dadiOH

ccdhofer said:
I'm wondering if there is a way to sort files within a folder by file
name other than alphabetical/numerical. My dilemma is that I will
have folders that will have 4 digit numbers that will be always
preceeded by an "S" or a "K". The numbers will also be followed by
various letters, starting at A,B,C, on and so on. For instance,
examples of files would look like this: S7054A; S7054B; S7054C;
K7055A; K7055B;
S7056A..... I would like to have the actual 4 digit number (not
including the prefix letter) in numerical order, as shown in the
example. If I sort by name alone, it puts all of the "K" files first
in numerical order, and then the "S" files in numerical order after
that. In essence, I would like the files sorted numerically by the
SECOND character in the file name. IS there a way to do this? I
will have MANY folders that will contain files such as these. I am
using Windows XP professional 2002.

Your best bet is to rename the files so that the number precedes the "K",
"S" or whatever. For example, rename K7055A to 7055A-K or 7055A_K. Most
any bulk renamer can do this easily.

That would sort them the way you want but still keep your distinguishing
letter available. A potential difficulty arises if you were to have two
files named identically except for the letter; eg,
K7055A
and
S7055A
If renamed as I suggested, they would display as...
7055A-K
7055A-S

--

dadiOH
____________________________

dadiOH's dandies v3.06...
....a help file of info about MP3s, recording from
LP/cassette and tips & tricks on this and that.
Get it at http://mysite.verizon.net/xico
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top