GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Reverse name, except extension

jscript
scripting

#1

Overview

This rename preset will reverse all of the filename, except the extension which is left as-is:

How it works

It's done using a single line of JScript:

Caveats

  • Unicode support in general is fine; however, UTF-16 characters that use surrogate pairs will not reverse properly.

    Such characters are rare, especially in filenames, so this probably won't cause you problems. Also, applying the reversal twice should still get back the original string; you may just seem some strange characters in the initial reversal where a surrogate pair was.

    The UTF-16 emoji codeblock uses surrogate pairs, so this will affect those. Combining characters for complex scripts will also be affected. Both should still double-reverse OK.

    While the script could be modified to handle surrogate pairs better, it would greatly complicate things, and seems unnecessary.

Download

Use

  • You can then use the preset within the Rename dialog by double-clicking it in the list on the left of the dialog.

  • Or you can use it directly from the lister via the menu attached to the Rename button:

    Reverse Stem via menu

  • Or you can create a button or hotkey which runs the preset directly, on all selected items, using this command:

    @NoDeselect
    Rename PRESET="Reverse Stem"
    

Alternatives

Some alternative rename presets/scripts for doing the same thing are discussed in this thread. To my knowledge, they will all work as well as each other and it's just a matter of coding style and language: