Command: RenameEx (extended Rename command)

RenameEx - a script-addin for extended "Rename" functionality.

Features summary:

Main command line switches:

  • NUMBER Add numbering to items (this wraps the native Rename NUMBER command)
    • Options: = <startindex> Default is 1

    • Switches:

      • REMOVENUM Try to remove existing numbering from affected items
      • PAD The number of digits in padding, default is "auto"
      • PADWITH The characters used for padding, default is "0" (only applies to totals)
      • BY Increment when renaming items, default is 1
      • PATTERN Defaults to (.*?)((?:[^A-z0-9]*|\\s*)?\\D?\\d+.*?)?($|\\..*)
      • TO Defaults to {stem} {num}{ext}

      Following additional vars are available (also the native ones with FILEINFO):

      • {num} The ongoing number
      • {stem} Item stem or basename (without extension)
      • {ext} The items extension (including .)
      • {total} Total item count
      • {totalfiles} Total file count
      • {totaldirs} Total dir count
      • {totalsel} Selected item count
      • {totalselfiles} Selected file count
      • {totalseldirs} Selected dir count
    • Examples:

      • Add basic numbering in front of extension, remove existing numbering at first
        RenameEx NUMBER REMOVENUM

      • Add numbering and ".. of x" in front of extension, pad numbers to 3-digits
        RenameEx NUMBER PAD=3 TO="{stem}-{num} of {totalsel}{ext}"

      • Do not add numbering, just add "of x" in front of extension, padding as required
        RenameEx NUMBER PAD TO="{stem} of {totalsel}{ext}"

      • Enter a new name for all selected items and append numbering and ".. of x"
        RenameEx NUMBER PAD TO="{dlgstring|New filename:|{file|noext}} - {num} of {totalsel}{ext}"

Global switches/options:

  • PATTERN Works like the regular PATTERN of the rename command
  • FROM Works like the regular FROM of the rename command
  • TO Works like the regular TO of the rename command
  • FILEINFO Works like the regular FILEINFO of the rename command
  • NODESELECT Do not deselect selected items
  • PT Switches and options to PassThrough to the native Rename command
  • XLOG Level of output, defaults to normal, which means important information only
    • Options: = off,xit,err,inf,warn,,trace,dump

Installation:

To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.

ToDo:

Merge with RenameFromClipboard.

Trouble-Shooting:

In case you encounter errors, add XLOG=dump to your commandline or raise the global log level in the script config.

Then re-do what failed and post the result (output) right here! o)

cya,
tb

Download:

The command.. RenameEx NUMBER PAD TO="{stem} of {totalsel}{ext}"

..fails when run against selected files in Downloads as shown below..


If I copy the files to a normal folder - e.g. C:\Test - and run the same command it works properly.

Regards, AB

Updated to v0.1.1:

  • unwanted output fixed
  • padding error fixed

Thanks aussie! o))
I guess it was not necessarily related to that folder, but to the number of items within.

Will you be adding button to these or Commandline only?

Thank you

Thanks for your interest! o)

This command will be overhauled at some time, as I'm not yet satisfied on how it works internally. Until then, I guess I won't provide a button with defaults. The other thing is, finding defaults for a rename-button is probably not easy, as everyone has his own preferences on how to re-name things, but maybe yes. Maybe there should be a button to download nonetheless! o)

Hello,

Sorry if this is a stupid question but I am a little new at this. I tried out this script also but I was not successful.

dopo asked
"Will you be adding button to these or Commandline only?"

Does this mean that the above RenameEx script can only be run through a Commandline meaning you have to type the commands out in the command line field each time you want to apply it to files?

I tried both making it a tool button as well as trying to enter it into a command line field but I wasn't able to get it to work.

Seems that in your response, you may still be working on this one.
I am new to applying user based scripts, some I can get to work and others I have not.
I don't specifically need this script it is more the question if I am doing something wrong.
I have come across a couple of other hiccups in other scripts but I will put them in the appropriate threads.

Thank You

Buttons can make use of commands or scripts (which again can use commands). This is a command and there are some example command lines given, which you can put into a button if you wish, but you don't need to, you can run them in a DO commandline as well. So this thread just does not provide a button with presets which run this command. You can make your own button quite easily from the example command lines given above, it's just some copy and paste work.

Sorry being new to some of this stuff, I read into this one incorrectly on how to set it up and I got a little confused.
I now have gotten this one to work, testing it a little it now makes more sense to me, I see what you mean about making buttons, there are so many things this script can do that each user will have a different button depending on their individual needs.

Wow, how the heck are you doing all of this, I wish I could script like this.
Next on my list is to test your SelectEx, not sure if it will be something that I will use as of yet but it is funny, many of these things it takes a while get used to using them and they don't seem needed and then before you know it you use them so much you can't imagine not having them.

Thank You for the script and your response.