[–] 5 points 5 months ago (2 children)

I think you want something like this:

$ ls
'Star Trek Next Generation Season 01 Episode 22 - Bob.mkv'
'Star Trek Next Generation Season 1 Episode 1 - Encounter at Farpoint.mkv'
$ file-rename 's/.*Season (\d+) Episode (\d+)/sprintf("S%02dE%02d", $1, $2)/ie' *.mkv
$ ls
'S01E01 - Encounter at Farpoint.mkv'  'S01E22 - Bob.mkv'

If you are getting an angle bracket, it's probably because you didn't add *.mkv at the end.

  • source