Linux needs to be taught how to count...
How does one get Linux to not automatically sort the directory contents by
number? I have a CDROM of 225 MP3's that are named one though
two-hundred-twenty five. (1-255). When I go to burn the cdrom the programs
automtically re-arrange the order, 1-9,then 100, 102 etc through 110, then
11, then 111 etc. It's like Linux cannot count properly. Or is doing it by
translating hex numbers or something. Whatever, I have to burn the cdrom
in Windows to get it right. And that's unacceptable, that means I have to
install windows.....
Re: Linux needs to be taught how to count...
The files are ordered lexically.
You need to run "sort -n" on them to get them ordered as you want.
paul <paul@noret-pksings.net> wrote in message news:<pan.2003.12.14.14.44.46.239448@noret-pksings.net>...[color=blue]
> How does one get Linux to not automatically sort the directory contents by
> number? I have a CDROM of 225 MP3's that are named one though
> two-hundred-twenty five. (1-255). When I go to burn the cdrom the programs
> automtically re-arrange the order, 1-9,then 100, 102 etc through 110, then
> 11, then 111 etc. It's like Linux cannot count properly. Or is doing it by
> translating hex numbers or something. Whatever, I have to burn the cdrom
> in Windows to get it right. And that's unacceptable, that means I have to
> install windows.....[/color]
Re: Linux needs to be taught how to count...
paul <paul@noret-pksings.net> wrote in message news:<pan.2003.12.14.14.44.46.239448@noret-pksings.net>...[color=blue]
> How does one get Linux to not automatically sort the directory contents by
> number? I have a CDROM of 225 MP3's that are named one though
> two-hundred-twenty five. (1-255). When I go to burn the cdrom the programs
> automtically re-arrange the order, 1-9,then 100, 102 etc through 110, then
> 11, then 111 etc. It's like Linux cannot count properly. Or is doing it by
> translating hex numbers or something. Whatever, I have to burn the cdrom
> in Windows to get it right. And that's unacceptable, that means I have to
> install windows.....[/color]
It's sorting them like strings...
But the way to sort them like string would be
1 10 100 101 102 103 104 105 106 107 108 109 11 110 111 112 113 114
etc.
I've noticed that too in linux...
I'm still working on how to fix it... I'll e-mail you or something if
I find a solution
Re: Linux needs to be taught how to count...
paul <paul@noret-pksings.net> wrote in message news:<pan.2003.12.14.14.44.46.239448@noret-pksings.net>...[color=blue]
> How does one get Linux to not automatically sort the directory contents by
> number? I have a CDROM of 225 MP3's that are named one though
> two-hundred-twenty five. (1-255). When I go to burn the cdrom the programs
> automtically re-arrange the order, 1-9,then 100, 102 etc through 110, then
> 11, then 111 etc. It's like Linux cannot count properly. Or is doing it by
> translating hex numbers or something. Whatever, I have to burn the cdrom
> in Windows to get it right. And that's unacceptable, that means I have to
> install windows.....[/color]
A silly way would be to arrange them with Modification Date order and
then select Reversed Order...
That will only work though if 1 is older than 2, 2 is older than 3, 3
is older than 4, etc. etc. etc., 244 is older that 255...
cmad
Re: Linux needs to be taught how to count...
In comp.os.linux.admin Chris Mantoulidis <cmad_x@yahoo.com> wrote:[color=blue]
> paul <paul@noret-pksings.net> wrote in message news:<pan.2003.12.14.14.44.46.239448@noret-pksings.net>...[color=green]
> > How does one get Linux to not automatically sort the directory contents by[/color][/color]
Linux doesn't sort directories. Your application lists a directory any
way it likes.
[color=blue][color=green]
> > number? I have a CDROM of 225 MP3's that are named one though
> > two-hundred-twenty five. (1-255). When I go to burn the cdrom the programs
> > automtically re-arrange the order, 1-9,then 100, 102 etc through 110, then
> > 11, then 111 etc. It's like Linux cannot count properly. Or is doing it by[/color][/color]
Lexical ordering. Set your application to use some other ordering if
you don't like that. Maybe you'd prefer reverse polish?
[color=blue][color=green]
> > translating hex numbers or something. Whatever, I have to burn the cdrom
> > in Windows to get it right. And that's unacceptable, that means I have to
> > install windows.....[/color]
>
> A silly way would be to arrange them with Modification Date order and
> then select Reversed Order...[/color]
If he can arrange them, he can arrange them the way he likes!
[color=blue]
> That will only work though if 1 is older than 2, 2 is older than 3, 3
> is older than 4, etc. etc. etc., 244 is older that 255...[/color]
It will only work if he can "arrange them". And if he can, then he
should arrange them to his taste.
If it were me I would set LC_COLLATE to something suitable and see if
his app observed the instruction! If the app doesn't have a "sort
order" button, that is.
Peter
Re: Linux needs to be taught how to count...
On Mon, 15 Dec 2003 16:30:21 +0000, P.T. Breuer wrote:
[color=blue][color=green]
>> paul <paul@noret-pksings.net> wrote in message
>> news:<pan.2003.12.14.14.44.46.239448@noret-pksings.net>...[color=darkred]
>> > How does one get Linux to not automatically sort the directory
>> > contents by[/color][/color]
> Linux doesn't sort directories. Your application lists a directory any
> way it likes.[/color]
Wasn't there a kernel patch or option or something which did sort
directories on ext[23]? I'm pretty sure I saw one somewhere...
[color=blue][color=green][color=darkred]
>> > number? I have a CDROM of 225 MP3's that are named one though
>> > two-hundred-twenty five. (1-255). When I go to burn the cdrom the
>> > programs automtically re-arrange the order, 1-9,then 100, 102 etc
>> > through 110, then 11, then 111 etc. It's like Linux cannot count
>> > properly. Or is doing it by[/color][/color]
> Lexical ordering. Set your application to use some other ordering if you
> don't like that. Maybe you'd prefer reverse polish?[/color]
Offhand, I can't think of any applications which will let me select the
sort order of a file listing (talking strictly about file names here).
Even Nautilus only offers a choice of "sorted" vs. "unsorted". Now, we
can add "LANG=" to the sorting options list, but that doesn't really count
in this discussion, since that will change sorting globally across the
app.
[color=blue][color=green][color=darkred]
>> > translating hex numbers or something. Whatever, I have to burn the
>> > cdrom in Windows to get it right. And that's unacceptable, that means
>> > I have to install windows.....[/color]
>> A silly way would be to arrange them with Modification Date order and
>> then select Reversed Order...[/color]
> If he can arrange them, he can arrange them the way he likes![/color]
Not necessarily. To take Nautilus as an example again, how would I get
the files in a directory view to be sorted in numeric order (appart from
dragging them around, which may not be an option in his application).
[color=blue][color=green]
>> That will only work though if 1 is older than 2, 2 is older than 3, 3
>> is older than 4, etc. etc. etc., 244 is older that 255...[/color]
> It will only work if he can "arrange them". And if he can, then he
> should arrange them to his taste.[/color]
As above, considering that any number of applications provide a few fixed
sorting schemes such as date, size, and so on. But very few allow for
non-simple (other than the language collation sequence) sorting of names.
[color=blue]
> If it were me I would set LC_COLLATE to something suitable and see if
> his app observed the instruction! If the app doesn't have a "sort order"
> button, that is.[/color]
Could you, then, continue your good advice by suggesting an LC_COLLATE
setting which will put "some5.pic" before "some10.pic" (as per the OPs
question)?
Fredderic
Re: Linux needs to be taught how to count...
Fredderic wrote:[color=blue]
> Could you, then, continue your good advice by suggesting an LC_COLLATE
> setting which will put "some5.pic" before "some10.pic" (as per the OPs
> question)?[/color]
IMO, the best way is to name them "correctly". "some5.pic"
should be "some0005.pic", "some10.pic" should be
"some0010.pic". Depending on the number of files you expect
to collect in that directory you might need to make it
"some0000005.pic" or the like.
Re: Linux needs to be taught how to count...
In comp.os.linux.admin Fredderic <ciredderf@sumirpi.is_backwards_at.com.au> wrote:[color=blue]
> On Mon, 15 Dec 2003 16:30:21 +0000, P.T. Breuer wrote:
>[color=green][color=darkred]
> >> paul <paul@noret-pksings.net> wrote in message
> >> news:<pan.2003.12.14.14.44.46.239448@noret-pksings.net>...
> >> > How does one get Linux to not automatically sort the directory
> >> > contents by[/color]
> > Linux doesn't sort directories. Your application lists a directory any
> > way it likes.[/color]
>
> Wasn't there a kernel patch or option or something which did sort
> directories on ext[23]? I'm pretty sure I saw one somewhere...[/color]
In what sense? Entries in a directory "really" go any old way.
Whenever you type "ls" you see them sorted in the order dictated by
LC_COLLATE. That's what ls does.
There is a kernel patch to do binary tree access instead of linear access
to the dir entries in ext2, AFAIR.
[color=blue][color=green]
> > Lexical ordering. Set your application to use some other ordering if you
> > don't like that. Maybe you'd prefer reverse polish?[/color]
>
> Offhand, I can't think of any applications which will let me select the
> sort order of a file listing (talking strictly about file names here).
> Even Nautilus only offers a choice of "sorted" vs. "unsorted". Now, we[/color]
Dir listing. I don't use file browsers. Apart from ls. Which does.
[color=blue]
> can add "LANG=" to the sorting options list, but that doesn't really count[/color]
LC_COLLATE.
I gave him the clue.
[color=blue]
> in this discussion, since that will change sorting globally across the
> app.[/color]
That's what he wants.
[color=blue][color=green][color=darkred]
> >> A silly way would be to arrange them with Modification Date order and
> >> then select Reversed Order...[/color]
> > If he can arrange them, he can arrange them the way he likes![/color]
>
> Not necessarily. To take Nautilus as an example again, how would I get
> the files in a directory view to be sorted in numeric order (appart from[/color]
I don't know what nautilus is (some gnomish thing?). But I'd set
LC_COLLATE when calling it, and see what happens.
[color=blue]
> dragging them around, which may not be an option in his application).[/color]
It depends on his app.
[color=blue]
> As above, considering that any number of applications provide a few fixed
> sorting schemes such as date, size, and so on. But very few allow for
> non-simple (other than the language collation sequence) sorting of names.
>
>[color=green]
> > If it were me I would set LC_COLLATE to something suitable and see if
> > his app observed the instruction! If the app doesn't have a "sort order"
> > button, that is.[/color]
>
> Could you, then, continue your good advice by suggesting an LC_COLLATE
> setting which will put "some5.pic" before "some10.pic" (as per the OPs
> question)?[/color]
uh .... no. I don't think that was his question, but I may well be
mistaken! There is no way to know that some5.pic should come before
some10.pic, becuase I know of no ordering in which 5 comes before 1.
I suggest he renames it some05.pic and then all will be hunky.
Peter
Re: Linux needs to be taught how to count...
P.T. Breuer wrote:
[color=blue]
> I don't know what nautilus is (some gnomish thing?).[/color]
For someone who doesn't know, you guess real good! :o)
--
Garry Knight
garryknight<at>gmx.net ICQ 126351135
Linux registered user 182025
Re: Linux needs to be taught how to count...
On Tue, 16 Dec 2003 17:19:36 -0600, "Kevin D. Snodgrass" <kdsnodgrass@yahoo.com> wrote:
[color=blue]
> IMO, the best way is to name them "correctly". "some5.pic"
> should be "some0005.pic", "some10.pic" should be
> "some0010.pic". Depending on the number of files you expect
> to collect in that directory you might need to make it
> "some0000005.pic" or the like.[/color]
.... agreed
--
<< [url]http://michaeljtobler.homelinux.com/[/url] >>
Captain Penny's Law: You can fool all of the people some of the
time, and some of the people all of the time, but you Can't Fool Mom.
Re: Linux needs to be taught how to count...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
["Followup-To:" header set to comp.os.linux.admin.]
On 2003-12-17, P.T. Breuer <ptb@oboe.it.uc3m.es> wrote:[color=blue]
> In comp.os.linux.admin Fredderic <ciredderf@sumirpi.is_backwards_at.com.au> wrote:[/color]
[color=blue][color=green]
>> Could you, then, continue your good advice by suggesting an LC_COLLATE
>> setting which will put "some5.pic" before "some10.pic" (as per the OPs
>> question)?[/color]
>
> uh .... no. I don't think that was his question, but I may well be
> mistaken![/color]
Okay...do you really expect someone who can't recognize lexical
ordering to be able to set LC_COLLATE?
[color=blue]
> There is no way to know that some5.pic should come before
> some10.pic, becuase I know of no ordering in which 5 comes before 1.
> I suggest he renames it some05.pic and then all will be hunky.[/color]
The OP would probably have gotten this answer a lot sooner had he
not been such a putz about posting his question (stupid x-post,
blaming linux when PEBKAC, not describing anything about the
apps he was using).
- --keith
- --
[email]kkeller-usenet@wombat.san-francisco.ca.us[/email]
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/37WkhVcNCxZ5ID8RAnGwAJ0SFZKl/Uu0RGmKNb/Und++mU+yKwCfaJQc
HlbvsxSnBphS7rioP/QAqX0=
=q7/2
-----END PGP SIGNATURE-----
Re: Linux needs to be taught how to count...
Fredderic wrote:
[color=blue]
> Offhand, I can't think of any applications which will let me select the
> sort order of a file listing (talking strictly about file names here).
> Even Nautilus only offers a choice of "sorted" vs. "unsorted". Now, we
> can add "LANG=" to the sorting options list, but that doesn't really count
> in this discussion, since that will change sorting globally across the
> app.[/color]
Offhand, I can't think of any KDE application which does *not* let me select
sort order.
-- robin
Re: Linux needs to be taught how to count...
On Tue, 16 Dec 2003 17:47:18 -0800, Keith Keller wrote:
[color=blue][color=green][color=darkred]
>>> Could you, then, continue your good advice by suggesting an LC_COLLATE
>>> setting which will put "some5.pic" before "some10.pic" (as per the OPs
>>> question)?[/color]
>> uh .... no. I don't think that was his question, but I may well be
>> mistaken![/color]
> Okay...do you really expect someone who can't recognize lexical
> ordering to be able to set LC_COLLATE?[/color]
One might also mention that to such a person as that, those leading zero's
would be very unnatural.
And in fact, there's no particularly good reason why such a natural,
obvious, and generally useful natural ordering shouldn't be supported.
Computers may look at things one character at a time, but humans don't. A
human processes entire words and numbers as a single unit, and tends to
expect a computer to at least seem like it's doing the same.
Lexical ordering is not obvious, and natural numeric ordering isn't that
hard to implement. I've seen it implemented in at least one PC
command.com alternative. I actually had it set as the default ordering of
the DIR command, and not once had any problems with ordering being messed
up as a result (it's unusual to find occasions where the length of a
number is less significant than the digits therein -- which is essentially
what lexical ordering implies -- if that makes sense to anyone but me ;) ).
[color=blue][color=green]
>> There is no way to know that some5.pic should come before
>> some10.pic, becuase I know of no ordering in which 5 comes before 1.
>> I suggest he renames it some05.pic and then all will be hunky.[/color]
> The OP would probably have gotten this answer a lot sooner had he
> not been such a putz about posting his question (stupid x-post,
> blaming linux when PEBKAC, not describing anything about the
> apps he was using).[/color]
I rather agree here... Though the OP has a point also. This remind me of
all the patent crap going on, which usually resolves to a question of what
is, and is not, "obvious". The OP wanted to use an obvious (in human
terms), natural numbering order, which also happens to be reasonably easy
to implement, and should be able to do so without too much difficulty.
Still..... I find this debate quite interesting myself. But then I
usually do enjoy the curly ones. ;)
Fredderic