Results 1 to 10 of 10

Thread: Minor issue with file sorting

  1. #1
    Join Date
    Oct 2019
    Beans
    95

    Question Minor issue with file sorting

    I have a minor pet peeve with Bionic Beavers 18.4 File Browser (Nautilus style)
    I have thousands of pictures in many folders which sometimes use the & symbol for example "Mom & Dad 01" while others might no icons have just letters or numbers or both.

    I was a Windows user beforehand (and switched for greater security) and in File Explorer all files with & in the name niftily appear on top, always ahead of numbered images with only name and number like Dad 01.
    But Ubuntu isn't user friendly and just wants to push those to the bottom.

    Is there any software, script or command which always places any icon names like "Mom & Dad 01 named files to the very top in a file explorer format. I already have them Alphabetic Order Ascending (A-Z). (I want to avoid any tedius process of renaming thousands of images just to add a and word).
    Last edited by nocruoro; November 17th, 2019 at 04:13 PM.
    I am from Iceland.

  2. #2
    Join Date
    Feb 2010
    Location
    In My Food Forest
    Beans
    9,318

    Re: Minor issue with file sorting

    From what I've seen, Linux file managers will put filenames starting in special characters if they are to first charater of the filename, otherwise numbers are put first like in your situation. Mass renaming in Nautilus is easy.

    Don't give up hope, yet, though. Someone else may know a workaround.
    Cheers & Beers, uRock
    [SIGPIC][/SIGPIC]

  3. #3
    Join Date
    Oct 2019
    Beans
    95

    Re: Minor issue with file sorting

    Quote Originally Posted by uRock View Post
    From what I've seen, Linux file managers will put filenames starting in special characters if they are to first charater of the filename, otherwise numbers are put first like in your situation. Mass renaming in Nautilus is easy.

    Don't give up hope, yet, though. Someone else may know a workaround.
    I hope so & is a tradition in my namings. I hate to change it. Ubuntu is already a hard decision after i nearly lost my current laptop to viruses.
    I am from Iceland.

  4. #4
    Join Date
    Feb 2010
    Location
    In My Food Forest
    Beans
    9,318

    Re: Minor issue with file sorting

    Quote Originally Posted by nocruoro View Post
    I hope so & is a tradition in my namings. I hate to change it. Ubuntu is already a hard decision after i nearly lost my current laptop to viruses.
    I was actually surprised when I tested to see that it treats filenames differently when the special character vs number wasn't at the beginning of the filename. I tested it in both Thunar and PCmanFM.
    Cheers & Beers, uRock
    [SIGPIC][/SIGPIC]

  5. #5
    Join Date
    Oct 2019
    Beans
    95

    Re: Minor issue with file sorting

    Quote Originally Posted by uRock View Post
    I was actually surprised when I tested to see that it treats filenames differently when the special character vs number wasn't at the beginning of the filename. I tested it in both Thunar and PCmanFM.
    And people say ubuntu is flexible yet it drags you down if you're not careful.
    I am from Iceland.

  6. #6
    Join Date
    Feb 2010
    Location
    In My Food Forest
    Beans
    9,318

    Re: Minor issue with file sorting

    Quote Originally Posted by nocruoro View Post
    And people say ubuntu is flexible yet it drags you down if you're not careful.
    Something like that would never get me down. I can't blame ubuntu as that's how the file managers work on all Linux distros to my knowledge. I haven't used Windows at home since roughly 2010, so haven't thought much of how Windows Explorer displays files.
    Cheers & Beers, uRock
    [SIGPIC][/SIGPIC]

  7. #7
    Join Date
    Dec 2014
    Beans
    2,565

    Re: Minor issue with file sorting

    It probably can be done, but it would be a lot of work. You'd have to redefine the collation rules in your locale definition. See 'man locale', 'man localedef', 'man 5 locale' and probably 'man 5 charmap'. The sources for the definitions are in /usr/share/i18n/locales and the binary / compiled version are in /usr/lib/locale. You should only view these, you can create your own in your $HOME and make the system use those. The manual pages I mentioned give some examples on how to do that, but they are dense reading as man pages often are.

    Holger

  8. #8
    Join Date
    Mar 2007
    Beans
    313

    Re: Minor issue with file sorting

    I am not sure why you blame linux for this. Linux uses a normal alphabetical order. How is it supposed to know that a & in the middle of the name means something special in the Windows world? In any case, no need to 'tediously' rename files; the command line is your friend. With the bash shell you can easily rename 1000s of files if you want. Just to get started, test something like (no need to type the # and following comments):

    for i in "*\&*" # this matches anything with & in the name.
    do
    wc $i # just do a work-count to test your script
    done


    Now, if this looks okay and you are feeling brave (test on a copied directory first!), you could replace the "wc $i" with e.g. "mv $i 000icon_$i", which would move e.g. ''aaaa & bbb' to '000icon_aaa & bbb'. This which would ensure that all such files are alphabetically grouped at the beginning of the list.

    More elegant, one could skip all those for loops, and just type:

    rename "s/&/and/" *

    in the directory and all is renamed

    I've only done brief tests on my system, but something like the above should work if this is what you need.

  9. #9
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Minor issue with file sorting

    There is also pyrenamer to try.

    This 16.04 (last version) download seems to work in 18.04.

    ...

    A second option. Since you refer to File Explorer (Nautilus) there are
    python extensions to add to Nautilus.

    https://www.giuspen.com/nautilus-pyextensions/

    Download Nautlius PyExtensions.
    Last edited by dragonfly41; November 21st, 2019 at 11:34 AM. Reason: added Nautilus PyExtensions idea

  10. #10
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Minor issue with file sorting

    Are you sure it is the & and not the spaces?

    When I used Windows I often had spaces in file names. But in Linux that is not recommended and you have to either quote or escape names with spaces if typing into a command line. Not sure then how each gui program handles the spaces.
    I learned to just use CamelCase, under_score, or justaname.

    When you mount Windows NTFS partitions it also is recommended to use windows_names.
    Window_names prevents the use of invalid windows characters:
    (which are the nine characters ” * / : < > ? \ | and those whose code is less than 0×20)
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

Bookmarks

Posting Permissions

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