Directory Renaming Recursively

I have a directory structure of:

[Root]\Artist\Year - Album(tracks...)


[Root]\Amy Winehouse\2003 - Frank(tracks...)

I want to replace:

2003 - Frank


(2003) Frank

or perhaps

[2003] Frank

Now I found an action that suits me for this purpose:

Replace with regular expression:
Regular expression:
Replace matches with:
($1) $2

I tested it and it works. My question is:
Is it possible to apply this action recursively now, for a bigger directory tree?

Why not build the wanted directory new instead of changing parts of the existing directory?

Action-Type: Format Value
Field: _directoty
Format string: \%artist%[%year%] %album%

I agree with poster that an action of the type "Format value" is better suited for the purpose.
The pseudo-variable _DIRECTORY addresses the folder "above" the filename.
So: yes, any folders you have loaded will be renamed according to the pattern you define in the "format value" action.

Well I will give it a try...
I just wanted to correct my post.
Actually, I am not looking for "recursive", as my directory depth is always the same.
As I described above.
I just want to apply the action, "iteratively", on a long directory list of artists.
Thanks though.
I will post back maybe with my results.
But, can the "Format Value" action, be applied on many artists directories? Lets see...

EDIT: OK first things first.
According to:

So its: Format string: \%artist%'['%year%']' %album%

Still, I cant make it work this far...
What I get, is empty folders.
Is this what you meant?
You see, I want to have the MP3s inside those folders...
I am doing something wrong...

This should work ...

Set Filter:

"%_DIRECTORY%" MATCHES "(\d\d\d\d)\s-\s"

Action: Format value
... or ...
Converter: Tag - Tag
Formatstring: $regexp(%_directory%,'(\d\d\d\d)\s-\s','($1) ')

... or ...

Formatstring: $regexp(%_directory%,'(\d\d\d\d)\s-\s','[$1] ')

Mp3tag performs the filesystem procedure "MOVE folder" with all files in the specified folder.


I have removed the $2 referrer in the replacement part of the regexp, because it was not declared in the expression and it is actually not needed.


IT WORKED! Absolutely brilliant!
Great work DetlevD.

For anyone interested, I figured out the opposite.
From a directory containing:

[2013] ThisAlbum


2013 - ThisAlbum

"%_DIRECTORY%" MATCHES "([[])(\d\d\d\d)([]])"

Format Value:
Format string:
$regexp(%_directory%,'([[])(\d\d\d\d)([]])','$2 -$4')

PS: Please test this first with some samples...
Also others can verify if this code is OK...

Set Filter for four digits and one space character at the first position,
with the number surrounded by ...

... round brackets
"%_DIRECTORY%" MATCHES "^(\d{4})\s"

... square brackets
"%_DIRECTORY%" MATCHES "^[\d{4}]\s"

... curly brackets
"%_DIRECTORY%" MATCHES "^{\d{4}}\s"

... round or square or curly brackets
"%_DIRECTORY%" MATCHES "^[[({]\d{4}[])}]\s"

Remove brackets ...
Action: Format value
... or ...
Converter "Tag - Tag"

... round brackets
Formatstring: $regexp(%_directory%,'^((\d{4}))\s','$1 ')

... square brackets
Formatstring: $regexp(%_directory%,'^[(\d{4})]\s','$1 ')

... curly brackets
Formatstring: $regexp(%_directory%,'^{(\d{4})}\s','$1 ')

... round or square or curly brackets
Formatstring: $regexp(%_directory%,'^[({[])}]\s','$1 ')


EVEN better.
First, it has the ^ character for matching the start of a line.
This makes it more secure, as I was worried about possible collisions with albums that have a year as part of their titles.
Then, a nice touch with more compact \d{4}.
And also, that we don't need $2, just $1.