Skip to content
Advertisement

Can someone help me with rename tool? [closed]

I have to rename a bunch of files with this structure (it is a serie): SSEE_SerieName_Episode.Name.With.Dots_[some_variables_qualities].mkv

SS is season number like 03 and EE episode number like 08 (with leading zero). Plex can’t recognize it because of it’s crappy name… So I would like to rename it like this: sSSeEE_SerieName_Episode.Name.With.Dots.mkv

Advertisement

Answer

Assuming:

  • You are using the Perl rename command.
  • The Episode.Name.With.Dots substring does not contain an underscore character.
  • You want to remove the _[some_variables_qualities] substring.
  • The substring above starts with an underscore character.

Then would you please try the following:

rename 's/(d{2})(d{2})(_SerieName_[^_]+)_.*.mkv/s$1e$2$3.mkv/' *.mkv

It renames:

0102_SerieName_Episode.Name.With.Dots_[some_variables_qualities].mkv

as:

s01e02_SerieName_Episode.Name.With.Dots.mkv

Please modify the _SerieName_ portion in the command above according to your real filenames.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement