Article 4VZ2Y Rename files sequentially

Rename files sequentially

by
snowman81
from LinuxQuestions.org on (#4VZ2Y)
I'm looking at the rename utility but I can't figure out how to rename files with the pattern I want. For example, I have the following innocuous file names:

DBZ.-.001.-.The.New.Threat.mp4*
DBZ.-.002.-.Reunions.mp4

etc.

And I want to replace everything between the dashes with S1E1, S1E2, etc.

I found an example from Google but am unsure how to adapt it to my situation.

Code:rename -n 'our $i; s/_.*/sprintf("_%03d.png", $i++)/e' *.pngMaybe replace everything between dashes with Code:S$nE$i, n++, i++?latest?d=yIl2AUoC8zA latest?i=A0YpB3xN1wA:m64QywbD4kE:F7zBnMy latest?i=A0YpB3xN1wA:m64QywbD4kE:V_sGLiP latest?d=qj6IDK7rITs latest?i=A0YpB3xN1wA:m64QywbD4kE:gIN9vFwA0YpB3xN1wA
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments