Linux needs to be taught how to count... - Linux

This is a discussion on Linux needs to be taught how to count... - Linux ; 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 ...

+ Reply to Thread
Results 1 to 13 of 13

Thread: Linux needs to be taught how to count...

  1. 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.....




  2. 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 wrote in message news:...
    > 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.....


  3. Re: Linux needs to be taught how to count...

    paul wrote in message news:...
    > 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.....


    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

  4. Re: Linux needs to be taught how to count...

    paul wrote in message news:...
    > 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.....


    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

  5. Re: Linux needs to be taught how to count...

    In comp.os.linux.admin Chris Mantoulidis wrote:
    > paul wrote in message news:...
    > > How does one get Linux to not automatically sort the directory contents by


    Linux doesn't sort directories. Your application lists a directory any
    way it likes.

    > > 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


    Lexical ordering. Set your application to use some other ordering if
    you don't like that. Maybe you'd prefer reverse polish?

    > > 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.....

    >
    > A silly way would be to arrange them with Modification Date order and
    > then select Reversed Order...


    If he can arrange them, he can arrange them the way he likes!


    > 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...


    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

  6. Re: Linux needs to be taught how to count...

    On Mon, 15 Dec 2003 16:30:21 +0000, P.T. Breuer wrote:

    >> paul wrote in message
    >> news:...
    >> > How does one get Linux to not automatically sort the directory
    >> > contents by

    > Linux doesn't sort directories. Your application lists a directory any
    > way it likes.


    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...


    >> > 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

    > Lexical ordering. Set your application to use some other ordering if you
    > don't like that. Maybe you'd prefer reverse polish?


    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.


    >> > 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.....

    >> A silly way would be to arrange them with Modification Date order and
    >> then select Reversed Order...

    > If he can arrange them, he can arrange them the way he likes!


    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).


    >> 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...

    > It will only work if he can "arrange them". And if he can, then he
    > should arrange them to his taste.


    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.


    > 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.


    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

  7. Re: Linux needs to be taught how to count...

    Fredderic wrote:
    > 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)?


    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.


  8. Re: Linux needs to be taught how to count...

    In comp.os.linux.admin Fredderic wrote:
    > On Mon, 15 Dec 2003 16:30:21 +0000, P.T. Breuer wrote:
    >
    > >> paul wrote in message
    > >> news:...
    > >> > How does one get Linux to not automatically sort the directory
    > >> > contents by

    > > Linux doesn't sort directories. Your application lists a directory any
    > > way it likes.

    >
    > 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...


    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.


    > > Lexical ordering. Set your application to use some other ordering if you
    > > don't like that. Maybe you'd prefer reverse polish?

    >
    > 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


    Dir listing. I don't use file browsers. Apart from ls. Which does.

    > can add "LANG=" to the sorting options list, but that doesn't really count


    LC_COLLATE.

    I gave him the clue.

    > in this discussion, since that will change sorting globally across the
    > app.


    That's what he wants.

    > >> A silly way would be to arrange them with Modification Date order and
    > >> then select Reversed Order...

    > > If he can arrange them, he can arrange them the way he likes!

    >
    > 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


    I don't know what nautilus is (some gnomish thing?). But I'd set
    LC_COLLATE when calling it, and see what happens.

    > dragging them around, which may not be an option in his application).


    It depends on his app.

    > 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.
    >
    >
    > > 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.

    >
    > 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)?


    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

  9. Re: Linux needs to be taught how to count...

    P.T. Breuer wrote:

    > I don't know what nautilus is (some gnomish thing?).


    For someone who doesn't know, you guess real good! )

    --
    Garry Knight
    garryknightgmx.net ICQ 126351135
    Linux registered user 182025

  10. Re: Linux needs to be taught how to count...

    On Tue, 16 Dec 2003 17:19:36 -0600, "Kevin D. Snodgrass" wrote:

    > 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.



    .... agreed

    --
    << http://michaeljtobler.homelinux.com/ >>
    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.

  11. 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 wrote:
    > In comp.os.linux.admin Fredderic wrote:


    >> 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)?

    >
    > uh .... no. I don't think that was his question, but I may well be
    > mistaken!


    Okay...do you really expect someone who can't recognize lexical
    ordering to be able to set LC_COLLATE?

    > 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.


    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

    - --
    kkeller-usenet@wombat.san-francisco.ca.us
    (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-----

  12. Re: Linux needs to be taught how to count...

    Fredderic wrote:

    > 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.


    Offhand, I can't think of any KDE application which does *not* let me select
    sort order.

    -- robin


  13. Re: Linux needs to be taught how to count...

    On Tue, 16 Dec 2003 17:47:18 -0800, Keith Keller wrote:

    >>> 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)?

    >> uh .... no. I don't think that was his question, but I may well be
    >> mistaken!

    > Okay...do you really expect someone who can't recognize lexical
    > ordering to be able to set LC_COLLATE?


    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 ).


    >> 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.

    > 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).


    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

+ Reply to Thread