it's so confusing that the order changes when adding IDENTICAL strings to BOTH filenames. Is this really how it's supposed to be?
What you expecting called natural sorting. Mac employed natural sorting back in 90s. What you get is legitimate Alphabetical sorting which used by Linux and Windows. Natural sorting parses tokens in the string and compares them. Alphabetical sorting compares two strings by comparing individual characters at same index (position). Alphabetical sorting is quite common as it simpler to implement (or rather harder to screw up) and yields predictable results
One of many libraries for Python which implements natural sorting https://github.com/SethMMorton/natsort
i'm not quite sure whether i understood your question but this seems to be right. the
5
fromS01E05.*5*.mkv
is higher in the alphabet thenm
fromS01E05.*m*kv
so it belongs above that entry.Check the top: apparently "5" < "5.5" but "5 A" > "5.5 A". It's probably because a substring is lexicographically before the string containing it.
But when comparing
5 A
with5.5 A
the second characters' '
and'.'
get compared and apparently'.'
<' '
.agree on your point though.
I see, but wouldn't it make more "human readable sense" to order spaces before any other character? Any human working with analog archives would rank 5 A before 5.5 A, since they think 5 is 5.0 in their head
I don't know the exact reasoning for it, I would guess it's because '.' is also used to delimit file types "A book on the.pdf" < "A book on the pdf.pdf" or "Book.pdf" < "Book sequel.pdf"
I guess your confusion has in part to do with reading digits as numbers, but within a string they are part of an alphabet, every character stands on its own and has no relation to the characters around it. There is no difference between "5 1", "5.1" and "511" you just pick an ordering of the alphabet and then sort each character accordingly.
What you're looking for is version sort. Here's how
ls -1v
sorts those files in the terminal, for example:Link Click S01E04.mkv Link Click S01E05.mkv Link Click S01E05.5.mkv Link Click S01E06.mkv
Nemo might be able to support version sort by way of a plugin, but I have not found one. The
nnn
CLI file manager supposedly supports version sort.