Page 1 of 1
[Solved] Script Rename Regex and Extension
Posted: 08 Apr 2024 14:32
by GreetingsFromPoland
hi! i am currently using this in my hamburger menu :
and it works great. up to this point all the files i use this on have been MKVs. now i have other extensions as well.
what needs to change in the regex to tell it to leave the existing extension as-is ? right now, i use the command (which works, but renames everything to .mkv), then use the Set Extension option under Rename to set it back.
Re: Script Rename Regex and Extension
Posted: 08 Apr 2024 14:36
by highend
Provide real world renaming examples...
or otherwise, wild guessing:
rename r, "(.*?)(-[^-]*?)(\.[^.]+)$ > $1$3";
Re: Script Rename Regex and Extension
Posted: 08 Apr 2024 14:51
by GreetingsFromPoland
hi!
edit you're too fast ! your updated post worked great ! thank you.
as-is, it will rename "01-Introduction-1.mkv" to "01-Introduction.mkv" and it's great (handbrake appends -1, -2, etc. to conversions).
now i am converting to mp4, so "02-Understanding the Effect Hook-2.mp4" becomes "02-Understanding the Effect Hook-2.mkv" due to the mkv setting in the regex rename.
i'd like to have the rename regex just leave the extension alone, regardless of what it is, so :
01-Introduction-1.mkv would be 01-Introduction.mkv
02-Understanding the Effect Hook-2.mp4 would be 02-Understanding the Effect Hook.mp4
03-Effect Dependencies-3.mp3 would be 03-Effect Dependencies-3.mp3
(instead of all them renaming to mkv).
Re: Script Rename Regex and Extension
Posted: 08 Apr 2024 14:54
by highend
That's what the regex in my first post does...