Results 1 to 5 of 5

Thread: Sort Order in Working Directory Question.

  1. #1

    Default Sort Order in Working Directory Question.

    Using LEAP42.1 with KDE Plasma desktop.

    I wish to understand how is the sort order for displaying files in Dolphin determined.
    I ask because I have a list of 50+ files which include in their file name "[Disk_X]" where X is 1 to 56.
    Even with leading zeros missing they still display in correct order in Dolphin

    However when I look at same directory with Puddletag I get a different order with files with single digit numbers shown at end of decade eg: [Disk_1] follows [Disk_19]. [Disk_2] follows [Disk_29] etc.

    I have solved the problem by including leading zeros but am interested to learn what determines the sort order in each case.
    Budgie2

  2. #2
    Join Date
    Sep 2013
    Location
    Norfolk, UK
    Posts
    1,265

    Default Re: Sort Order in Working Directory Question.

    Puddletag is sorting "correctly" based on the ASCII representation of the filename.

    Dolphin is sorting using "Natural sorting of items" (Changeable from dolphin settings "Settings -> Configure Dolphin -> General -> Behaviour - Natural sorting of items).

    (I've no idea if Puddletag's sorting is configurable...)
    Regards, Paul

    2x Tumbleweed (Snapshot: 20191016) KDE Plasma 5
    2x Leap 15.1 KDE Plasma 5

  3. #3

    Default Re: Sort Order in Working Directory Question.

    Quote Originally Posted by tannington View Post
    Puddletag is sorting "correctly" based on the ASCII representation of the filename.

    Dolphin is sorting using "Natural sorting of items" (Changeable from dolphin settings "Settings -> Configure Dolphin -> General -> Behaviour - Natural sorting of items).

    (I've no idea if Puddletag's sorting is configurable...)
    Hi and thanks for the reply. I understand what you have written but have no idea what criterion is used for "Natural Sorting of Items" or even that this mode existed.

    Further down the line these files are stored on a NAS, served by server (minimserver) and played using a control point which can also display files in some modes. It would be good to have them all using the same criterion when displaying directory listings. I guess the "correct" way will be safest but maybe putting a number as first character would be safest until I know more.

    Thanks again,
    Budgie2

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,156

    Default Re: Sort Order in Working Directory Question.

    Quote Originally Posted by tannington View Post
    Puddletag is sorting "correctly" based on the ASCII representation of the filename.
    And even that is approximation of what may be the "correct" way of sorting. As Linux file names are nowadays in Unicode, ASCII is only a subversion of what could/should be a "correct" sorting. The collating sequence of characters in scripts is a factor here. Please do not guess that this is something that only emerges when using "exotic" alphabets. Even German has (at least) two types of sorts. One where e.g. ü comes somewhere after z (used in a dictionary like Duden) and one where ü is near ue (in a telephone directory). The last case means that the family names Müler and Mueler are found together in case you are not sure which one of those, having the same pronounciation, to look for.

    I type all this to show that not only "natural" sorting has a lot of personal preferences, but even "correct" can be difficult to define.

    I am afraid that software that claims to do one or more of both may offer you bewildering results depending on your personal interpretation of the words "corerct', "natural" and the contents of environment parameters like LANG.
    Last edited by hcvv; 12-Mar-2016 at 03:49.
    Henk van Velden

  5. #5
    Join Date
    Sep 2013
    Location
    Norfolk, UK
    Posts
    1,265

    Default Re: Sort Order in Working Directory Question.

    Quote Originally Posted by Budgie2 View Post
    It would be good to have them all using the same criterion when displaying directory listings. I guess the "correct" way will be safest but maybe putting a number as first character would be safest until I know more.
    As "hcvv" pointed out in more detail, sorting order is not necessarily straightforward.

    The safest option would be to stay with the leading zero approach, and perhaps also limit the alpha characters to just Aa-Zz.

    You might want to consider using more than one leading zero though, "Disk_001" for example.
    Regards, Paul

    2x Tumbleweed (Snapshot: 20191016) KDE Plasma 5
    2x Leap 15.1 KDE Plasma 5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •