How can I rename the folder using the *album* tag?

How can I rename the source folder using the album tag ?

I have absolutely hundreds of albums that have the file tags neatly arranged , but the folders that contain those files are a pain to sort , because the folder 'name' often does not accurately describe what kind of music is actually in the folder

Here's an example, currently i have a folder on my desktop called simply Greatest Hits 2CD's

all the files within that folder have the album tag ABBA Gold Greatest Hits

What do i need to do within MP3TAG , so that it renames the folder to ABBA Gold Greatest Hits ?

thanks

Lee

Ok , i worked out how to do this , following the same logic to a question i asked a long time ago (i'd lost the original action i created , when i installed a newer version of MP3TAG) :rolleyes: , anyway -

create a NEW action in the action group

Action type Format value
Field: _DIRECTORY
Format string: %album%

i then highlight all the files in that folder , and apply the above action

This does exactly what i wanted to achieve in my first question :smiley:

So ! , now i have a similar problem that appears to be a lot more complicated !

Here's the example

i have a 'parent folder' which is named The Cure , if i click on that folder , there are two sub-folders named CD1 and CD2 each with 15 mp3 files .
All the mp3 files in both of these subfolders have the album tag Cure (The): Greatest Hits

Problem -
if i apply the above action to all the files in subfolders CD1 and CD2 , the parent folder name remains un affected - but ! - it moves all of the 30 files into one new subfolder , and this is named Cure (The): Greatest Hits .
The sub folders CD1 and CD2 do not exist anymore

Question-

          how can i get it to rename the parent folder <b>Cure (The): Greatest Hits</b> ? 

I'd be happy for the subfolders to either be renamed Cure (The): Greatest Hits 1 and Cure (The): Greatest Hits 2 , or preferably , to get rid of the sub folders all together and put all 30 mp3 files in the parent folder.

Is this possible ?

Lee

Select the files

Press Alt+5

Set _DIRECTORY in the "Field:" box

Put %album% in the "Format string:" box

Press or click [OK]

Thanks Chris , but your suggestion just achieves the same thing as the original action i created - it renames the subfolder , but the not the parent folder

Lee

_PARENT_DIRECTORY is not writeable in 2.5.8

https://docs.mp3tag.de/converters/rearrange-filenames is one way but you cannot rename directories.

You would have find a bunch of answers anywhere in the forum.

Use converter "Tag - Tag" or action "Format value".

Field: _DIRECTORY Formatstring: $validate('.\..\'%ALBUM%'\'%_directory%,'-')

... or ...

Formatstring: $validate(%_folderpath%'..\..\'%ALBUM%'\'%_directory%,'-')

... or ...

Formatstring: $validate($replace(%_folderpath%'*','\'%_parent_directory%'\'%_directory%'\*','\'%ALBUM%'\'%_directory%'\'),'-')

The empty old album folder may still exist after the operation.
But all additionally other folder content have been moved too.

Use converter "Tag - Tag" or action "Format value".

Field: _FILENAME Formatstring: $validate(%_folderpath%'..\..\'%ALBUM%'\'%_directory%'\'%_filename_ext%,'-')

The old folder tree still exists after the operation.
There have been left all additionally other folder content.

DD.20140214.2035.CET
DD.20140215.1155.CET
DD.20140216.1902.CET

I would use an absolute path ... I am pretty sure that you have a pattern that consists of the contents of the tag fields.
That would not leave empty folders, if you "format value" _DIRECTORY with the absolute path
e.g.
d:\music\%artist%\%album%[\cd%discnumber%]

It doesn't, neither does using _FILENAME with an absolute path.

At best you end up with a duplicate of the selected file in a new folder structure.

OR if you have multiple files you get a lot of nested folders named with each of the parts of the format.

It does. It is even a recommended procedure in the FAQ section of the forum:
/t/8016/1

Folders
And no: MP3tag does not copy files with any action or converter, there is always only one file.
And yes, you end up with nested folders if you use the relative path. It never happens with an absolute path.
So I stick to my advice in post 7.

Try it with a 'absolute' path, the colon is stripped out and it creates the specified folder path under the current working directory.

so D:\folder\%artist%\%album%\

becomes

current
|----- D
        |----folder
               |---artistname
                    |----album name
QUOTE (Chris Hirst @ Feb 15 2014, 14:25) <{POST_SNAPBACK}>
Try it with a 'absolute' path, the colon is stripped out and it creates the specified folder path under the current working directory.

so D:\folder\%artist%\%album%\

becomes

current
|----- D
        |----folder
               |---artistname
                    |----album name<!--QuoteEnd--></div><!--QuoteEEnd-->

I did and it did not behave in the way you described but just like I described it.
As you get the colon stripped out which is an illegal character for a filename (if it is relative) there must be something wrong with the way you set the path.
Try ot leave out the last backslash.

Actually we are both right, as I wasn't being specific enough.
Absolute paths (drive letter included) work for _FILENAME (Alt+1) but not for _DIRECTORY renames (Alt+5) which is what I was trying to accomplish.

This format pattern:

M:\NewMusic\$left(%albumartist%,1)\\%albumartist%\\%albumartist%[ - %year%][ - %album%][ - Disc%discnumber]\[$num(%track%,2) - ][%title%]

Applied to _FILENAME, will create the correct structure, but if you have files other than music files, cover images etc. they will remain behind in the original directory.

Neither of you ... ... ... I am right. :smiley:
How can I rename the folder using the album tag ?

DD.20140215.1935.CET

Alt-1 and Alt-5 refer to the functions in the Convert menu.
I refer to the actions and an action of the type "Format value".
And with this action for _DIRECTORY you do get a renamed folder with all the files that are in the source folder moved to the target folder.

Correct, which is what I was testing with, NOT the "Action group" scripting, this was based on the assumption/guess that most users will be using the 'Convert' menu options rather than writing action scripts.

Now if the two methods result in different results using the same formatting pattern, that may be indicative of an difference/error/glitch/bug in the way that MP3tag handles the scripting from the two sources and more testing is required to determine why this occurs, or it maybe that _DIRECTORY should be disallowed in the "Tag to Tag" convert.

On the other hand any differences may be deliberate and if so a proviso should be included in the user manual/help to inform of this.

I cannot confirm this behaviour.

DD.20140216.1255.CET

Okay, I shall do more testing to see if I can isolate what and where the issue is/was.

Use converter "Tag - Tag" or action "Format value".

Field: _DIRECTORY Formatstring: $validate(%_folderpath%'..\..\'%ALBUM%'\'%ALBUM%' '$regexp(%_directory%,'^\D+',),'-')

The empty old album folder may still exist after the operation.
But all additionally other folder content have been moved too.

From:
The Cure
├───CD1
└───CD2

To:
Cure (The)- Greatest Hits
├───Cure (The)- Greatest Hits 1
└───Cure (The)- Greatest Hits 2

To:
The Cure
[empty]

DD.20140216.1328.CET

At first make sure that all related filenames are unique, so that they can be moved together into the one target folder without name collision.

Use converter "Tag - Tag" or action "Format value".

Field: _DIRECTORY Formatstring: $validate(%_folderpath%'..\..\'%ALBUM%'\','-')

... or ...

Formatstring: $validate($replace(%_folderpath%'*','\'%_parent_directory%'\'%_directory%'\*','\'%ALBUM%'\'),'-')

The empty old album folder may still exist after the operation.
But all additionally other folder content have been moved too.

When undoing this operation, Mp3tag runs into an error condition, because it cannot restore the formerly removed subfolders.
All files will be moved into one subfolder of the old source folder.

DD.20140216.1359.CET