3 ms·
If I understand the article, the author wants magic :) I take it to mean they want the system to know file_9.txt is less then file_10.txt. I never saw that ha
by jmclnx 1y ago
If I understand the article, the author wants magic :)
I take it to mean they want the system to know file_9.txt is less then file_10.txt.
I never saw that happen in any OS, so I do not know what he is referring to. Maybe whatever that old system was, it sorted by create time as opposed to file name.
So, the author can try and create "aisort" that will look at all file names and add leading zeros to the file numeric portion, sort, then remove the zeros added. That will probably as slow as s***t and use gobs pf memory, depending on the number of files.
- anopenben 1y agoNo the author is saying the opposite. They expect file9.txt to be after file10.txt, but it many modern operating systems, it isn’t!
- jmclnx 1y agoReally, 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
- sebtron 1y agoAuthor 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.
- zahlman 1y agoWhen I started using Linux as my daily driver after many years of Windows (but with familiarity with UNIX systems going way back), I knew it would be like that in the terminal, but it still took some adjustment. But actually, Nemo does the same "natural sort" thing, and also sorts case-insensitively.
- deleted 1y ago[deleted]
- mackeye 1y agoi think it's the opposite, that they _want_ file_10.txt to come before file_9.txt by default, but that file explorers fail at this. it's rare that i want true alphabetical sort, but it's convenient for cases like tfa where alphabetical sort is more predictable if i have filenames that look like <letters>_<numbers-of-same-length>.txt.
- uqers 1y agoThat's not what the author says- they said that file managers actually are somehow sorting file-9.txt before file-10.txt, and it's breaking real alphabetical ordering.
- HeavyStorm 1y agoNope, you got it completely reversed.
- meindnoch 1y ago>I take it to mean they want the system to know file_9.txt is less then file_10.txt. The polar opposite, actually.
- deleted 1y ago[deleted]
- nebezb 1y agoIt’s not magic. It’s called natural sort and it doesn’t require gobs of memory. Most (all?) modern OS file managers will natural sort on file names.