macOS Catalina - how to set up Finder to use file sorting logic same as ls command (alphabetical order, not “natural”)? [duplicate]
Frage
I noticed today that Finder has some strange logic of sorting files by name and I cannot figure out why is that.
Screenshot 1 - folder in "column" view with folder's options opened:
Screenshot 2 - same folder in "list" view, sorted by "Name" column:
Screenshot 3 - output of ls -al
command in terminal, correct and expected file sorting:
EDIT: I created a testing folder with integer file names only and the behaviour is the same.
How can I change Finder to use the same logic like ls
command?
Unfortunately, linked duplicate question doesn't answer my question above, only explains Finder's logic and behaviour in sorting files. What I would like to achieve, as stated in title and the question above, is to force Finder to sort files in alphabetical, not "natural" order.
Lösung
Apple's Finder has been using "natural" sort order (where strings of digits are ordered as single characters) for file names for nearly 20 years, since OS X 10.0 There's no way to change it as far as I know. If you want the other kind of sort order, you have to use Terminal or a 3rd party app.
Andere Tipps
Essentially, Finder is treating the numbers up to the first letter as its sort criterion.
So, as far as Finder is concerned, the order is 'correct' for
- 0
- 2
- 6
- 298
- 2655522
It is not considering the entirety of the name as a hexadecimal figure.
Based on your edit - terminal is 'wrong' - 6 is smaller than 2655522
It's still down to "if you want a computer to sort 'properly' give it leading zeroes".
I also made a test folder - the logic is perhaps awkward, but it is actually logical, for a given definition.
I think what Terminal is doing is sorting numbers like they were letters, so like e
would sort after aabbaccd
so 6
sorts after 2655522