Score:1

Wrong sorting order with Files

pe flag

I'm running Ubuntu 22.04.1. Here is a snapshot from Files of a folder sorted by name:

enter image description here

Why the files are not in alphabetical order?

Score:1
ng flag

Numbers are going to sort in numerical order, not alphabetical. I'm not sure what you were expecting.

That said, Nautilus uses "natural" sorting, so it divides the filename into chunks of numbers and letters rather than one character at a time. So "9" comes before "10" which comes before "017" which comes before "22" and so on.

Your files are being sorted by name just as they should be. You're just giving them odd names.

Paul Jurczak avatar
pe flag
The names were given by someone else. I expected `['10fcaaa3', '017c7c7b', '22eb0ac0']` to be sorted as `['017c7c7b', '10fcaaa3', '22eb0ac0']`, which is an alphabetical sort. Sane software does it.
ng flag
@PaulJurczak Sane software does what you tell it to do. Nautilus is told to use natural sorting. Now, you're not the only person to object to this, and if there isn't a way to change it there probably should be. As it is, you may want to consider using a different file manager.
mmagnuski avatar
kp flag
I agree with Paul - I don't think that "natural" sorting is very natural. I have the same intuition that this behavior isn't "sane". For me, a new Ubuntu user, the sorting is very counterintuitive. Especially if files have special characters in their name.
ng flag
@mmagnuski To me it makes perfect sense. I don't WANT my files with numeric names to be sorted the "natural" way they do it, but the reasoning is sound. A computer can't read your mind and know what you MEANT---it can't "intuit" that the file is a date, an integer, a floating point number, or an arbitrary string---it can only know what you SAID. So if I want my files sorted in a particular way, I name in a way that conforms to the program that's sorting them. It would be appropriate for the programmers to include a way to change the default sort, certainly. I still maintain that.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.