Move year from end of file to centre.

Bulk Rename Utility How-To's

Move year from end of file to centre.

Postby Dont-Panic » Mon Sep 20, 2021 11:07 am

Hi all. Loving this program and having read the forum extensively I have found many 'move date/year' topics, but can't get any to do what I need despite playing with RegEx.

I have a bunch of music files laid out like this:

Artist - Album (Year)

But I'd like them to be:

Artist - Year - Album

Obviously the Artist and Album might be longer than a single word. Also the year (e.g. 2011) is in parenthesis in the original but I want those removed as they'll be separated by a dash.

I assume this is an easy one but it's confusing me no end. Would some kind soul be able to assist?
Dont-Panic
 
Posts: 2
Joined: Mon Sep 20, 2021 10:52 am

Artist - Album (Year) ===> Artist - Year - Album

Postby Luuk » Mon Sep 20, 2021 8:02 pm

There is usually four different ways that Im seeing users conduct renames like the explanation.
The first is putting a checkmark in "simple", so then using a 'Match' and 'Replace' like...
%1 - %2 (%3)
%1 - %3 - %2

The simple expressions cant verify that %3 is a year, so instead some users say it like...
%1 - %2 (20%3)
%1 - 20%3 - %2
So at least then, they can know any text inside of the parenthesis will start with "20".


Without a checkmark in "simple", the three main ways Im usually seeing...
^(.+ - )(.+) \((\d{4})\)$
\1\3 - \2
This makes sure there are 4-digits inside of parenthesis, and the very last " - " says "end of Artist".
Without simple, we use \( and \) to say "(" and ")" since otherwise, the regex will use them for grouping.

^([^-]+ - )([^-]+) \(((19|20)\d{2})\)$
\1\3 - \2
Its just like above, except replacing "." with "[^-]" and also makes sure that year starts with 19 or 20.
Some users like doing it this way, to forbid renaming any files that have more than one hyphen.

^((?:(?! - ).)+ - )((?:(?! - ).)+) \(((19|20)\d{2})\)$
\1\3 - \2
Its just like above, but instead of forbidding more than one hyphen, it forbids having more than one " - ".
So names like... "Some-Artist-Name - Some-Title (Year)" could still be renamed, if its a worry.

Im usually type something like the last one, but its only because Im often conducting very many sub-folders.
And its unfortunate, but my filename-formats are often very different, so Im always being very extra careful.
For many users, the "simple" is good enough.. It really just depends on how different your filenames can be.
Luuk
 
Posts: 690
Joined: Fri Feb 21, 2020 10:58 pm

Re: Move year from end of file to centre.

Postby Dont-Panic » Tue Sep 21, 2021 7:05 pm

Luuk, your first suggestion worked perfectly. Yet to try the other options (I'm eager to understand this software!) but the first one works a treat.

Thank you so much! I appreciate your help.
Dont-Panic
 
Posts: 2
Joined: Mon Sep 20, 2021 10:52 am


Return to How-To