Rename TV Episodes

Apologies if this is super simple, but trying to add an additional condition for renaming TV episodes in the format;

show.1x10.mkv
to
show.S01E10.mkv

Replace : .(\d+)x seems ok
Replace with .S<something>E <something> lacks ability to put 2 digit season & episode numbers

I want to make sure it can rename shows with seasons going into double-digits, and of course episodes with single or double digits.

Appreciate any help someone can give.
Reply to #1:

Hi Chad,

One replace method should do it for you:

Replace: \.(\d+)x(\d+)
With: _$1S$2
Case sens: Checked
Reg Expr: Checked
Apply to: Name

I changed the period to an underscore, because periods can be problematic in further renames. But if you don't like that just leave out the "\." in replace and the "_" in the replace with. As you can see, you were on the right track with your first change.

Best,
DF
Reply to #2:
Thanks DF, appreciate the help.

Kept the replace as you'd said, and for the second, used;
.S0$1E$2

To get the name.S0xExx.mkv format.

Appreciate the advice about not using periods between words/elements, but have use them for my whole library so far, so I'll likely continue (may live to regret it, lol)

Thanks again for the assist. I need to get more familiar with regular expressions, that's for sure.

Hope you enjoy the rest of your Easter weekend
- Chad
Reply to #3:

Chad,
Sorry, I screwed up the S and E. My dog-brain at work! :) And of course periods work fine in most circumstances.

Thanks, happy Easter weekend up there too!

Best,
DF
Reply to #3:

Here's a script method that zero pads as desired regardless of the season or episode number:

let nameParts = item.newBasename.split (".");
if (nameParts.length < 2) return "Missing expected period in the filename";
let episodeDetes = nameParts[1].split (/x/i);
if (episodeDetes.length < 2) return "Invalid Episode id format";

//-- Build desired new filename:
let newFilename = nameParts[0] + `.S${episodeDetes[0].padStart (2, "0")}E${episodeDetes[1].padStart (2, "0")}`;

return newFilename; // set the new name
Reply to #5:
That's great, thanks! I'll give it a shot as well.

First time reaching out to the community, and the fast, helpful responses are really appreciated
Reply to #6:

We're all glad to help!

And Good Easter to you and DF as well