Earlier quoted context omitted.
Really, I do not know how I missed that :) I read it a couple of times to and I still thought he wanted it the other way. So my original comment kind of stands but in a opposite way. I have never see file_9.txt sorted before file_10.txt, I just tested it on OpenBSD and I got this, which I have always seen: $ ls|sort file_1.txt file_10.txt file_12.txt file_2.txt file_20.txt file_3.txt file_9.txt
Author here - My surprise stems exactly from the fact that for the last few years I have exclusively managed my files via a the UNIX shell, which behaves in the classical way.
When I say “alphabetical order”, I mean “alphabetical order”
41–50 of 385 posts
Re: When I say “alphabetical order”, I mean “alphabetical order”
#42Re: When I say “alphabetical order”, I mean “alphabetical order”
#43I think the algorithm is probably incorrect. A number starting with 0 should be treated lexically not numerically. Otherwise you have a situation where img_1_01.jpg and img_01_1.jpg does not have a complete ordering.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#44Earlier quoted context omitted.
You mean file9 before file10? I have some beef with microsoft, that you can only change this at the Computer level, not per user (see registry key below). Also they call it natural sorting for users, but logical sorting internaly. Unify your termini! [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoStrCmpLogical"=dword:00000001
To change it per user, set it in the user's hive instead of in the local machine hive (e.g. HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE)
https://learn.microsoft.com/en-us/windows/win32/sysinfo/regi...
Re: When I say “alphabetical order”, I mean “alphabetical order”
#45Digits and any other characters that are not A-Z and a-z should not get sorted. That's the true result of doing what you asked and not what you meant. Pedantic, but that's why we are here.
> Digits and any other characters that are not A-Z and a-z should not get sorted.
Do you suggest that sorting in any language other than English should be broken?Re: When I say “alphabetical order”, I mean “alphabetical order”
#46I thought this was pretty well known. E.g. the macOS Foundation library even exposes NSString.localizedStandardCompare() [1] which implements the sorting algorithm used by Finder, and should be used by any well-behaved macOS application. Windows uses StrCompareLogical [2]. [1] https://developer.apple.com/documentation/foundation/nsstrin... :) [2] https://learn.microsoft.com/en-us/windows/win32/api/shlwapi/...
I can’t think of any case where I would need purely alphabetical sort. In most photo browsing apps, photos will be sorted by timestamp rather than filename. If I really needed it to sort properly in file explorer, I would try sorting on created date. And failing that I would probably just normalize the file names.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#47Re: When I say “alphabetical order”, I mean “alphabetical order”
#48To answer the question in the article, I’m pretty sure Windows Explorer (and probably File Manager before that) has sorted filenames this way for at least 30 years.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#49But I'm a tech guy, I know what does "alphabetically" mean in the tech world. And it probably is not what common folks mean when they think "alphabetically" outside the tech world.
Edit: in fact, if I recall correctly, the proper term for this kind of sort (the one OP wants) is alphanumeric sort.
Re: When I say “alphabetical order”, I mean “alphabetical order”
#50> Well, apparently all these operating systems have decided that no, users are too dumb and they cannot possibly understand what alphabetical order means. So when you ask them to sort your files alphabetically, they don’t. Instead, they decide that if some piece of the file name is a number, the real numerical value must be used. Well, no. You don't actually ask them to sort in alphabetical order. You ask them to sor…
Yes, that make sense, but the problem is that this interpretation changed in the last 10 (15? 20?) years. It used to be that "by name" meant "by name, il alphabetical / lexicographical order" in pretty much every file manager.