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.

  • BougieBirdie@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    6
    arrow-down
    1
    ·
    1 month ago

    I’ve got a couple sources that can probably explain it better than I can, but here’s the gist:

    • Walk through each file you want to read
    • Walk through each line you want to read
    • Replace emojis using RegEx

    The tricky part seems to be defining the range of characters you want to replace. Most emoji are in a particular block of unicode, but there could be a few outliers particularly if you want to remove kaomoji.

    Here’s a Stack Overflow link where there’s some discussion on what that range will be.

    Here’s a Python script that shows how you might do it for one file.

    Good luck!

    • j4k3@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 month ago

      That Python script is awesome. Thanks for sharing. I might try to add that to my LLM text post processor.

      It is nice to make an AI assistant that is more conversational, but if it adds a single emoji, all bets are off. The LLM emoji cancer is terminal once started.