Hey, how would you go about this:

I have let’s say hundreds of files, most of which contain some emoji characters in the filenames. How to script - or if an app can do it great! - parsing all these files and removing those … idiotic characters.

Not for nothing but yeah Unicode is great, lots of languages yada yada, but emojis? Fucking emojis??? Ian Malcom thinks just because we could, doesn’t mean we should!

So yeah. Back in the day when I did some developing in VB, I guess I’d load the filenames into memory as strings and then do an instring replacement to null of any character that is within the char() range. So… if I could find out the range wherein lay the damned-to-hades-for-eternity emoji character set, I’d null those out or replace them each with an E for Evil.

So… anyone know the easy approach to scripting this? Or is there an app that will already do it?

I’m gonna look through all the options in krename kfind etc. all those but I doubt any of them has this.

Anyway thanks if you have any ideas. Especially something I can save and just use on a directory of files anytime.

  • corvuscache@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    2 months ago

    See if the command line utility “detox” removes it. I use it in a bash file that tidies everything up for me before I do my daily backup.

    Go to the directory you want to clean up and type:

    detox *

    If you don’t want to clean up everything, you can limit it. For example, if I only want to clean up PDF files, I’d do:

    detox *.pdf

    Detox replaces all the ugly characters with underscores. I personally hate underscores for most everything and use dashes instead. So after detox runs I also run:

    rename ‘y/_/-/’ *

    Then, because I want every file named only with lowercase letters, I also run:

    rename ‘y/A-Z/a-z/’ *

    (edit to remove duplicate info)