Windows text sort sequence problems

jimbo45

Well-known member
Member
VIP
Local time
9:28 PM
Posts
613
Location
Hafnarfjörður IS
Hi folks
Using standard (UK English alphabet) text sort sequence why do I get stuff shown as 1, 10, 11, 12 etc then 2, etc -- what I need is 1,2,---9,10 11 etc.
Any ideas

I've arranged UK keyboard, UK alphabet etc so what's the problem.

Cheers
jimbo
 

My Computer

System One

  • Operating System
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

johnlgalt

Antidisestablishmentarianistentarianist
Power User
VIP
Local time
5:28 PM
Posts
1,922
Location
3rd Rock
In Explorer, or a particular app?
 

My Computers

System One System Two

  • Operating System
    Windows 10 Pro X64
    Computer type
    PC/Desktop
    Manufacturer/Model
    HomeBrew
    CPU
    AMD Ryzen 9 3950X
    Motherboard
    MSI MEG X570 GODLIKE
    Memory
    4 * Corsair Vengeance 32 GB 3600 MHz
    Graphics Card(s)
    eVGA GeForce GTX 970 SSC ACX 2.0 (04G-P4-3979-KB)
    Sound Card
    Realtek® ALC1220 Codec
    Monitor(s) Displays
    2 * Lenovo LT2323pwA Widescreeen
    Screen Resolution
    2* 1920*1080
    Hard Drives
    3x Sabrent Rocket PCIe Gen4 NVMe M.2 1 TB SSD (SB-ROCKET-NVMe4-1TB)
    SanDisk Ultra SDSSDHII-960G-G25 960 GB SATA III SSD
    Crucial MX100 CT256MX100SSD1 256GB SATA III SSD
    2 * Seagate Barracuda 7200.12 ST31000528AS 1TB 7200 RPM --> RAID1
    PSU
    PC Power & Cooling’s Silencer Series 1050 Watt, 80 Plus Platinum
    Case
    Fractal Design Define 7 XL Dark ATX Full Tower Case
  • Operating System
    Windows 10 x64 Pro build 21H1
    Computer type
    Laptop
    Manufacturer/Model
    Dell Latitude E5470
    CPU
    Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz, 2501 Mhz, 2 Core(s), 4 Logical Processor(s)
    Motherboard
    Dell
    Memory
    16 GB
    Graphics card(s)
    Intel(R) HD Graphics 520
    Sound Card
    Intel(R) HD Graphics 520 + RealTek Audio
    Monitor(s) Displays
    Dell laptop display 15"
    Screen Resolution
    1920 * 1080
    Hard Drives
    Toshiba 128GB M.2 22300 drive
    INTEL Cherryvill 520 Series SSDSC2CW180A 180 GB SATA III SSD
    PSU
    Dell
    Case
    Dell
    Cooling
    Dell
    Mouse
    Logitech MX Master (shared) | Dell TouchPad
    Keyboard
    Dell
    Internet Speed
    AT&T LightSpeed Gigabit Duplex
    Browser
    Edge Chromium | Chrome | Firefox Nightly | Brave
    Antivirus
    Defender + MB4

iko22

Active member
Member
VIP
Local time
10:28 PM
Posts
349
Location
South West England
Yes, the text matching is done from left-to-right, so file sorting does not recognise such thing as units, tens, and hundreds. To get around that, I usually save files as file01, file02, ..., file10, file11, file12, etc. That way I don't encounter the problem in Explorer, when I go to sort things in order - until I reach file99, that is!!!

Same goes with date sequences. I always label files (or folder) names as file-year-month-day. That way I can sort them in alpha-numerical order, and my files will appear in my named date order.

Maybe not what you are looking for, but I hope it helps.
 

My Computer

System One

  • Operating System
    Windows 10
    CPU
    TBA
    Motherboard
    TBA

jimbo45

Well-known member
Member
VIP
Thread Starter
Local time
9:28 PM
Posts
613
Location
Hafnarfjörður IS
In Explorer, or a particular app?
Hi there
sometimes browsing multi-media files in VLC or similar apps (which use the file explorer API for browsing) the files show up 1,11,12....2 etc which is annoying if you want to play the files in track order. Renaming a whole slew of files is a mess !!!! -- I know when creating new files to prefix with leading zeros gets round problem.

Dates aren't a problem in European format (YYMMDD or DDMMYY so that works properly).

Cheers
jimbo
 

My Computer

System One

  • Operating System
    Windows XP,7,10,11 Linux Arch Linux
    Computer type
    PC/Desktop
    CPU
    2 X Intel i7

cereberus

Well-known member
Power User
VIP
Local time
10:28 PM
Posts
380
Windows uses lexicographical sorting - 1,2,3,4 etc are treated as alphabet characters, not numerical, so it sorts on 1st "letter", then second "letter" etc. This is historical due to "Hollerith" characters right basck in dawn of digital computing.

So to sort, you have to (for numbers up to 999), use leading digits of 00, for single digit, and 0 for double digit

so if you had 1, 2, 4, 26, 27, 31, 46, 106, 156, 999 you use 001, 002, 004, 026, 027, 031, 046, 106, 156, 999

This would nest sort by 1st char, and then by 2nd, then by third
1st 2nd 3rd
0 0 1
0 0 2
0 0 3 ---> as 1st 2 digits same, it sorts on 3rd digit
0 2 6 ----> now sorting on 2nd row, then 3rd row
0 2 7
0 3 1 - back to sorting on second row
0 4 7
1 0 6 - now back to sorting on 1st row
1 5 6 - now moving to second row.
9 9 9 - back to 1st row


Note sorting on date - Backward European YYMMDD always sorts in order. Forward European DDMMYY does not!

Forward EU 12th June 21, 11th July 21, 13th July 22,14th June 22 will get incorrectly sorted as

110721
120621
130722
140622


Backward EU will get correctly sorted as

210612
210711
220614
220713

i.e in correct order.

Of course, the illogical US MMDDYY format will sort wrong whether forwards or backwards for these selected numbers

US forward
061221
061422
071121
071322

US Backward
211107
211206
220713
221406

Only EU backwards will sort correctly for all dates.
 

My Computer

System One

  • Operating System
    Windows 10 Pro + others in VHDs
    Computer type
    Laptop
    Manufacturer/Model
    ASUS Vivobook 14
    CPU
    I7
    Motherboard
    Yep, Laptop has one.
    Memory
    16 GB
    Graphics Card(s)
    Integrated Intel Iris XE
    Sound Card
    Realtek built in
    Monitor(s) Displays
    N/A
    Screen Resolution
    1920x1080
    Hard Drives
    1 TB Optane NVME SSD, 1 TB NVME SSD
    PSU
    Yep, got one
    Case
    Yep, got one
    Cooling
    Stella Artois
    Keyboard
    Built in
    Mouse
    Bluetooth , wired
    Internet Speed
    72 Mb/s :-(
    Browser
    Edge mostly
    Antivirus
    Defender
    Other Info
    TPM 2.0

johnlgalt

Antidisestablishmentarianistentarianist
Power User
VIP
Local time
5:28 PM
Posts
1,922
Location
3rd Rock
Yup - that is exactly how I force sorting on my system.
 

My Computers

System One System Two

  • Operating System
    Windows 10 Pro X64
    Computer type
    PC/Desktop
    Manufacturer/Model
    HomeBrew
    CPU
    AMD Ryzen 9 3950X
    Motherboard
    MSI MEG X570 GODLIKE
    Memory
    4 * Corsair Vengeance 32 GB 3600 MHz
    Graphics Card(s)
    eVGA GeForce GTX 970 SSC ACX 2.0 (04G-P4-3979-KB)
    Sound Card
    Realtek® ALC1220 Codec
    Monitor(s) Displays
    2 * Lenovo LT2323pwA Widescreeen
    Screen Resolution
    2* 1920*1080
    Hard Drives
    3x Sabrent Rocket PCIe Gen4 NVMe M.2 1 TB SSD (SB-ROCKET-NVMe4-1TB)
    SanDisk Ultra SDSSDHII-960G-G25 960 GB SATA III SSD
    Crucial MX100 CT256MX100SSD1 256GB SATA III SSD
    2 * Seagate Barracuda 7200.12 ST31000528AS 1TB 7200 RPM --> RAID1
    PSU
    PC Power & Cooling’s Silencer Series 1050 Watt, 80 Plus Platinum
    Case
    Fractal Design Define 7 XL Dark ATX Full Tower Case
  • Operating System
    Windows 10 x64 Pro build 21H1
    Computer type
    Laptop
    Manufacturer/Model
    Dell Latitude E5470
    CPU
    Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz, 2501 Mhz, 2 Core(s), 4 Logical Processor(s)
    Motherboard
    Dell
    Memory
    16 GB
    Graphics card(s)
    Intel(R) HD Graphics 520
    Sound Card
    Intel(R) HD Graphics 520 + RealTek Audio
    Monitor(s) Displays
    Dell laptop display 15"
    Screen Resolution
    1920 * 1080
    Hard Drives
    Toshiba 128GB M.2 22300 drive
    INTEL Cherryvill 520 Series SSDSC2CW180A 180 GB SATA III SSD
    PSU
    Dell
    Case
    Dell
    Cooling
    Dell
    Mouse
    Logitech MX Master (shared) | Dell TouchPad
    Keyboard
    Dell
    Internet Speed
    AT&T LightSpeed Gigabit Duplex
    Browser
    Edge Chromium | Chrome | Firefox Nightly | Brave
    Antivirus
    Defender + MB4

CB

Retired Nurse
Member
VIP
Local time
4:28 AM
Posts
422
Location
Solo, Indonesia
As an additional trick. I use to put any special character like #, ~, -, or elses before filenames when it comes to a folder with hundred files in it, so that it always stays on top of the list.
 

My Computers

System One System Two

  • Operating System
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    MSI
    CPU
    Core i5 10400
    Motherboard
    MSI H510M Pro
    Memory
    16 gb
    Graphics Card(s)
    Digital Alliance GTX 750 Ti
    Sound Card
    Realtek
    Monitor(s) Displays
    Samsung 24 Curved
    Screen Resolution
    1920 x 1080
    Hard Drives
    Vi-Gen SSD NVMe 256 GB
    Seagate 2 TB
    WD 3 TB
    Seagate 4 TB
    PSU
    Infinity Striker Power
    Case
    VBR Panther
    Cooling
    Natuve
    Keyboard
    Logitech Wireless MK270
    Mouse
    Logitech Wireless MK270
    Internet Speed
    2mbps
    Browser
    Chrome
    Antivirus
    Defender
  • Operating System
    Mac OS Big Sur
    Computer type
    Laptop
    Manufacturer/Model
    Macbook
    CPU
    Intel Core i5
    Motherboard
    Apple
    Memory
    8mb
    Hard Drives
    SSD 240gb
    Browser
    Safari

johnlgalt

Antidisestablishmentarianistentarianist
Power User
VIP
Local time
5:28 PM
Posts
1,922
Location
3rd Rock
I usually sort by date (descending), in most cases, so I alter the dates of files I need to always show (or always hide) to ridiculously out of range dates, like year 3333, or year 1970.

Implementing the same trick using filenames as you mention, I would use special characters to keep files at the top of the list when sorting by name, and letters like XXX YYY and ZZZ at the beginning of the filename to force them to the end of a list.
 

My Computers

System One System Two

  • Operating System
    Windows 10 Pro X64
    Computer type
    PC/Desktop
    Manufacturer/Model
    HomeBrew
    CPU
    AMD Ryzen 9 3950X
    Motherboard
    MSI MEG X570 GODLIKE
    Memory
    4 * Corsair Vengeance 32 GB 3600 MHz
    Graphics Card(s)
    eVGA GeForce GTX 970 SSC ACX 2.0 (04G-P4-3979-KB)
    Sound Card
    Realtek® ALC1220 Codec
    Monitor(s) Displays
    2 * Lenovo LT2323pwA Widescreeen
    Screen Resolution
    2* 1920*1080
    Hard Drives
    3x Sabrent Rocket PCIe Gen4 NVMe M.2 1 TB SSD (SB-ROCKET-NVMe4-1TB)
    SanDisk Ultra SDSSDHII-960G-G25 960 GB SATA III SSD
    Crucial MX100 CT256MX100SSD1 256GB SATA III SSD
    2 * Seagate Barracuda 7200.12 ST31000528AS 1TB 7200 RPM --> RAID1
    PSU
    PC Power & Cooling’s Silencer Series 1050 Watt, 80 Plus Platinum
    Case
    Fractal Design Define 7 XL Dark ATX Full Tower Case
  • Operating System
    Windows 10 x64 Pro build 21H1
    Computer type
    Laptop
    Manufacturer/Model
    Dell Latitude E5470
    CPU
    Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz, 2501 Mhz, 2 Core(s), 4 Logical Processor(s)
    Motherboard
    Dell
    Memory
    16 GB
    Graphics card(s)
    Intel(R) HD Graphics 520
    Sound Card
    Intel(R) HD Graphics 520 + RealTek Audio
    Monitor(s) Displays
    Dell laptop display 15"
    Screen Resolution
    1920 * 1080
    Hard Drives
    Toshiba 128GB M.2 22300 drive
    INTEL Cherryvill 520 Series SSDSC2CW180A 180 GB SATA III SSD
    PSU
    Dell
    Case
    Dell
    Cooling
    Dell
    Mouse
    Logitech MX Master (shared) | Dell TouchPad
    Keyboard
    Dell
    Internet Speed
    AT&T LightSpeed Gigabit Duplex
    Browser
    Edge Chromium | Chrome | Firefox Nightly | Brave
    Antivirus
    Defender + MB4
Top Bottom