Removing a string of files with rename
I have been trying to batch rename a bunch of files so that they are
consistent and fit within the name structure that I have come up with. For
instance,I am renaming comics, and so I have a directory that looks like
this:
$ls *.cbr
Injustice - Gods Among Us 001 (2013) (Digital) (K6 of Ultron-Empire).cbr
Injustice - Gods Among Us 002 (2013) (Digital) (K6 of Ultron-Empire).cbr
Injustice - Gods Among Us 003 (2013) (Digital) (K6 of Ultron-Empire).cbr
My goal is to use rename the files so they look like the following:
Injustice - Gods Among Us 001.cbr
Injustice - Gods Among Us 002.cbr
Injustice - Gods Among Us 003.cbr
So I tried the following:
rename -n 's/^\d{3}.\.cbr/^\ $1.cbr/' *.cbr
Was assuming that by delimiting to the first set up on the 3 digit issue,
I could then change to rename everything starting from the beginning line
(Injustice - God Among Us) and add in the 3 digit issue number (\d{3})
everything would pan out. Needless to say, it didn't.
Although I would like a little direction on how to get this solved, I
really want to better understand how to leverage using pregex for future
use.
No comments:
Post a Comment