Natural Order Sorting

English support forum

Moderators: Hacker, petermad, Stefan2, white

ddofborg
Junior Member
Junior Member
Posts: 30
Joined: 2003-05-12, 15:11 UTC
Location: Netherlands
Contact:

Natural Order Sorting

Post by *ddofborg »

Hi,

I think it would be nice to be able to sort files with natural sort order.
So if you have: file3.jpg, file20.jpg, file2.jpg, file10.jpg, file1.jpg they would be sorted like this: file1.jpg, file2.jpg, file3.jpg, file10.jpg, file20.jpg and not like this (the normal ASCII way): file1.jpg, file10.jpg, file2.jpg, file20.jpg, file3.jpg

For more info:
http://www.naturalordersort.org/
http://sourcefrog.net/projects/natsort/

PS: I useed search, but didn't find anything on this topic!
TucknDar
Senior Member
Senior Member
Posts: 227
Joined: 2003-02-07, 09:44 UTC
Location: Oslo
Contact:

Post by *TucknDar »

Sounds reasonable to me, I think I'd prefer using such an option.
license #76904
ddofborg
Junior Member
Junior Member
Posts: 30
Joined: 2003-05-12, 15:11 UTC
Location: Netherlands
Contact:

Post by *ddofborg »

yes, it's a great option, especially for image files or documents with version numbers in the filename!
TucknDar
Senior Member
Senior Member
Posts: 227
Joined: 2003-02-07, 09:44 UTC
Location: Oslo
Contact:

Post by *TucknDar »

Actually, the more I think of it, the more logic this option sounds to me... sorting pictures from pic1.jpg, pic2.jpg ... pic10.jpg, pic11.jpg ... pic20.jpg sure makes lots more sense than pic1.jpg, pic10.jpg, pic2.jpg...

Good thinking, ddofborg!
license #76904
ddofborg
Junior Member
Junior Member
Posts: 30
Joined: 2003-05-12, 15:11 UTC
Location: Netherlands
Contact:

Post by *ddofborg »

well, i implemented the Natural Order Numerical Sorting Algorithm once for my application. And it's very usefull for a file manager if you ask me!
TucknDar
Senior Member
Senior Member
Posts: 227
Joined: 2003-02-07, 09:44 UTC
Location: Oslo
Contact:

Post by *TucknDar »

Yeah, I can imagine.
license #76904
User avatar
pdavit
Power Member
Power Member
Posts: 1529
Joined: 2003-02-05, 21:41 UTC
Location: Kavala -> Greece -> Europe -> Earth -> Solar System -> Milky Way -> Space
Contact:

Post by *pdavit »

It’s one of those cases where everyone is annoyed by something but due to getting used to it nobody has the “ability” to trigger it! I would certainly like this feature too. I cannot think of any cases where the current sorting will be needed but just in case we can always have a tick box in configurations or an ini entry.
"My only reason for still using M$ Window$ as an OS is the existence of Total Commander!"
Christian Ghisler Rules!!!
ddofborg
Junior Member
Junior Member
Posts: 30
Joined: 2003-05-12, 15:11 UTC
Location: Netherlands
Contact:

Post by *ddofborg »

first of all, the sorting of normal files is the same. it's only for numbers!

so you always have XXX10.DOC after XXX2.DOC or XX1.10.DOC after XX0.9.DOC.

it's an extention to the normal ways of srting, it's not that diff. it is a bit slower though.
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

Well, I've never thought about it before (although I needed it) . But it sounds interesting...
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
ddofborg
Junior Member
Junior Member
Posts: 30
Joined: 2003-05-12, 15:11 UTC
Location: Netherlands
Contact:

Post by *ddofborg »

ghisler, what do you think? would it be possible for you to implement?
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

It's very hard(at least for me:?) to imagine the good algorithm for the "natural" sorting. The numbers in filename is just charachters. How should be sorted files 1pic2.jpg, 2pic5.jpg, 5pic3.jpg? BTW i live in Israel and in hebrew filenames sometimes used right-to-left reading order. Any suggestion? :lol: I think is much more easy to use standard sorting and zero-leading padding.
ddofborg
Junior Member
Junior Member
Posts: 30
Joined: 2003-05-12, 15:11 UTC
Location: Netherlands
Contact:

Post by *ddofborg »

VadiMGP wrote:It's very hard(at least for me:?) to imagine the good algorithm for the "natural" sorting. The numbers in filename is just charachters. How should be sorted files 1pic2.jpg, 2pic5.jpg, 5pic3.jpg? BTW i live in Israel and in hebrew filenames sometimes used right-to-left reading order. Any suggestion? :lol: I think is much more easy to use standard sorting and zero-leading padding.
dude, there is nothing to implement. i posted a link, where you can download the algorithm for C!
User avatar
JackFoo
Senior Member
Senior Member
Posts: 373
Joined: 2003-02-05, 19:53 UTC
Location: ERROR

Post by *JackFoo »

Ok, reality check:
Normal sorting order is called dictionary order, and that is what's implemented in any file manager beginning with windows explorer and ending with TC. No program I know and respect implements the UNnatural order you suggest;

query: which of the files is first when sorting by name (ascending): [z.pop] or [1z.pop]
answer: normal order -> 1z.pop, z.pop
UNnatural order -> z.pop, 1z.pop (why you ask, because I meant '0' before 'z' I just didn't write it)

Can you see where I'm heading...

P.S. Did any of you write to Oxford so they would fix the 'UNnatural' order in their dictionaries.

Cheers.
ddofborg
Junior Member
Junior Member
Posts: 30
Joined: 2003-05-12, 15:11 UTC
Location: Netherlands
Contact:

Post by *ddofborg »

dude, z.gif is NOT 0z.gif!!!!!!!!!!!!!!!!

so, with natural sorting it still would be 1z.gif, z.gif

but, z10.gif and z2.gif, become z02.gif and z10.gif! you really have no idea what i'm talking about here, do you? there are other programs which can sort with Nat. Order Sort! And it's quite easy to implement!
Free fast image hosting: http://picserver.org/
User avatar
JackFoo
Senior Member
Senior Member
Posts: 373
Joined: 2003-02-05, 19:53 UTC
Location: ERROR

Post by *JackFoo »

dude, z.gif is NOT 0z.gif!!!!!!!!!!!!!!!!
My own quote.... please reread my previous post.
UNnatural order -> z.pop, 1z.pop (why you ask, because I meant '0' before 'z' I just didn't write it)
I'm not saying it's difficult, I'm saying that your so-called 'natural' order is not mine, moreover it's silly.
z11.kll z2.kll should be sorted as they are listed, if you want them to be in reverse -> pad the numbers with '0' because that is what you mean. And call Oxford not Christian.

Cheers.
Post Reply