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

**URL:** https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505
**Category:** General Discussion
**Created:** [February 14, 2014, 1:35pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505 "2014-02-14T13:35:05Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![uk\_lee](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/9de0a6/32.png) [@uk\_lee](https://community.mp3tag.de/u/uk_lee)
#### Post date: [February 14, 2014, 1:35pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/1 "2014-02-14T13:35:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![uk\_lee](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/9de0a6/32.png) [@uk\_lee](https://community.mp3tag.de/u/uk_lee)
#### Post date: [February 14, 2014, 2:16pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/2 "2014-02-14T14:16:48Z")

</div>

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:](https://community.mp3tag.de/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif ":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 😃

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

---

<div class="post-metadata">

### Author: ![chrishirst](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@chrishirst](https://community.mp3tag.de/u/chrishirst)
#### Post date: [February 14, 2014, 2:20pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/3 "2014-02-14T14:20:08Z")

</div>

Select the files

Press Alt+5

Set \_DIRECTORY in the "Field:" box

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

Press or click [OK]

---

<div class="post-metadata">

### Author: ![uk\_lee](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/u/9de0a6/32.png) [@uk\_lee](https://community.mp3tag.de/u/uk_lee)
#### Post date: [February 14, 2014, 2:48pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/4 "2014-02-14T14:48:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![chrishirst](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@chrishirst](https://community.mp3tag.de/u/chrishirst)
#### Post date: [February 14, 2014, 6:21pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/5 "2014-02-14T18:21:12Z")

</div>

\_PARENT\_DIRECTORY is not writeable in 2.5.8

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

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 14, 2014, 6:29pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/6 "2014-02-14T18:29:37Z")

</div>

> [@uk lee](#):
>
> ... _Action type_ Format value  
> _Field:_ \_DIRECTORY  
> _Format string:_ %album%  
> ... This does **exactly** what i wanted to achieve in my first question ...  
> Question- how can i get it to rename the parent folder ...

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

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [February 14, 2014, 6:53pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/7 "2014-02-14T18:53:48Z")

</div>

> [@uk lee](#):
>
> 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

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%]

---

<div class="post-metadata">

### Author: ![chrishirst](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@chrishirst](https://community.mp3tag.de/u/chrishirst)
#### Post date: [February 14, 2014, 8:57pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/8 "2014-02-14T20:57:42Z")

</div>

> [@ohrenkino](#):
>
> 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.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [February 15, 2014, 9:03am UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/9 "2014-02-15T09:03:30Z")

</div>

> [@Chris Hirst](#):
>
> It doesn't, neither does using \_FILENAME with an absolute path.
> 
> ...

It does. It is even a recommended procedure in the FAQ section of the forum:  
[/t/8016/1](https://community.mp3tag.de/t/8016/1)

[Folders](https://community.mp3tag.de/t/15448/4)  
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.

---

<div class="post-metadata">

### Author: ![chrishirst](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@chrishirst](https://community.mp3tag.de/u/chrishirst)
#### Post date: [February 15, 2014, 12:25pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/10 "2014-02-15T12:25:05Z")

</div>

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
```

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [February 15, 2014, 3:20pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/11 "2014-02-15T15:20:50Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![chrishirst](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@chrishirst](https://community.mp3tag.de/u/chrishirst)
#### Post date: [February 15, 2014, 5:08pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/12 "2014-02-15T17:08:28Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 15, 2014, 5:35pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/13 "2014-02-15T17:35:28Z")

</div>

> [@Chris Hirst](#):
>
> Actually we are both right ...

Neither of you ... ... ... I am right. 😃  
[How can I rename the folder using the _album_ tag ?](https://community.mp3tag.de/t/15505/6)

DD.20140215.1935.CET

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [February 15, 2014, 5:37pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/14 "2014-02-15T17:37:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![chrishirst](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@chrishirst](https://community.mp3tag.de/u/chrishirst)
#### Post date: [February 16, 2014, 10:45am UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/15 "2014-02-16T10:45:32Z")

</div>

> [@](#):
>
> Alt-1 and Alt-5 refer to the functions in the Convert menu.

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.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 16, 2014, 10:55am UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/16 "2014-02-16T10:55:41Z")

</div>

> [@Chris Hirst](#):
>
> ... 'Convert' menu options rather than writing action scripts. ... the two methods result in different results using the same formatting pattern ...

I cannot confirm this behaviour.

DD.20140216.1255.CET

---

<div class="post-metadata">

### Author: ![chrishirst](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/4af34b/32.png) [@chrishirst](https://community.mp3tag.de/u/chrishirst)
#### Post date: [February 16, 2014, 11:04am UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/17 "2014-02-16T11:04:07Z")

</div>

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

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 16, 2014, 11:28am UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/18 "2014-02-16T11:28:24Z")

</div>

> [@uk lee](#):
>
> ... 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**...  
> Question- how can i get ... the subfolders to either be renamed **Cure (The): Greatest Hits 1** and **Cure (The): Greatest Hits 2**...

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

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [February 16, 2014, 11:59am UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/19 "2014-02-16T11:59:05Z")

</div>

> [@uk lee](#):
>
> ... 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**  
> Question- how ... to get rid of the sub folders all together and put all 30 mp3 files in the parent folder ...

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

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [March 7, 2021, 8:25pm UTC](https://community.mp3tag.de/t/how-can-i-rename-the-folder-using-the-album-tag/15505/23 "2021-03-07T20:25:28Z")

</div>


