# Add tag from folder name to metadata

**URL:** <https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721>\
**Category:** Support\
**Created:** [March 17, 2022, 2:48pm UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721 "2022-03-17T14:48:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![zerocool2022](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/z/ecccb3/32.png) [@zerocool2022](https://community.mp3tag.de/u/zerocool2022)\
**Post date:** [March 17, 2022, 2:48pm UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/1 "2022-03-17T14:48:05Z")

</div>

The folder name of all my albums is “YEAR – TITLE [CD-FLAC]”. The [CD-FLAC] is my own identifier of an album I have so I know the exact quality of it just by looking at the folder name of the album. So on my albums that I have purchased the Hi-Res version of the identifier can also be [24-44.1-FLAC] or [24-96-FLAC] etc...

I want the identifier I use, such as [CD-FLAC], to be included in the album name of the metadata for each song I have. I am looking for an automated way of doing this in Mp3tag but I am not very good with coding.

I would appreciate any help I can get. Thank you!

---

<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:** [March 17, 2022, 2:50pm UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/2 "2022-03-17T14:50:27Z")

</div>

have a look at the all new documentation:

> **[Import Tags from File and Folder Names – Mp3tag Documentation](https://docs.mp3tag.de/converters/import-tags-from-filenames/)**
>
> Documentation on Filename to Tag, a converter to import tags from file and folder names. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

**Author:** ![zerocool2022](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/z/ecccb3/32.png) [@zerocool2022](https://community.mp3tag.de/u/zerocool2022)\
**Post date:** [March 17, 2022, 3:05pm UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/3 "2022-03-17T15:05:18Z")

</div>

Thank you I did see that but it doesn't help. Some of my folder names have extra text in them such as "YEAR - TITLE (Special Edition) [CD-FLAC]".

Basically I want to ignore everything about the folder name except my identifier at the end, [CD-FLAC] etc... Since my folder names vary is there any way of extracting just my Identifier contained with in the brackets [] regardless of whatever precedes it?

---

<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:** [March 17, 2022, 3:07pm UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/4 "2022-03-17T15:07:18Z")

</div>

did you have a look at the section about %dummy%?  
Just to get that clear: is there already data in the field ALBUM and you want to add that identifier?

---

<div class="post-metadata">

**Author:** ![zerocool2022](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/z/ecccb3/32.png) [@zerocool2022](https://community.mp3tag.de/u/zerocool2022)\
**Post date:** [March 21, 2022, 12:21am UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/5 "2022-03-21T00:21:39Z")

</div>

Yes so in the metadata of the album title I already have the album name, what I want to do is add the text inside the bracket [] form my folder that the album is in to the end of the album name metadata.

Example:  
If the metadata of my albums title is "This is my album", the folder that contains that albums songs is titled "1990 - This is my album [FLAC-CD]". I want [FLAC-CD] to be added to the album title metadata so the result would be the metadata of my album title is "This is my album [FLAC-CD]".

I understand I could just already us the folder name and exclude the "1990 - " but on a lot of my albums with several CD's the metadata of my album title is "This is my album: Bonus CD" or "This is my album: Live CD", but the folder that contains that does not have "Bonus CD" or "Live CD" added in the folder name.

This is why I just want to add the content inside of the brackets [] to the existing album name metadata.

---

<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:** [March 21, 2022, 6:49am UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/6 "2022-03-21T06:49:39Z")

</div>

Try an action of the type "Format value" for ALBUM  
Format string: `%album% $regexp(%_directory%,'.*\[(.*)\]',$1)`  
add whatever separator you want between %album% and $regexp().

---

<div class="post-metadata">

**Author:** ![zerocool2022](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/z/ecccb3/32.png) [@zerocool2022](https://community.mp3tag.de/u/zerocool2022)\
**Post date:** [March 21, 2022, 12:18pm UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/7 "2022-03-21T12:18:14Z")

</div>

Wow thank you so much that works really great! There are just 2 things I need to tweak then this will be perfect.

1. When I have a nested album such as CD1, how can the action grab the text within the bracket 1 folder level up? With album that have another folder inside called CD1 it just adds CD1 to the album title instead of what’s inside the bracket []

2. How can I get it so the bracket also appears within the album title? Right now if [FLAC-CD], the action pulls FLAC-CD and adds it to the album title. I also want the [] to be added so that [FLAC-CD] is added to the album title.

Thanks again I appreciate your hard work!

---

<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:** [March 21, 2022, 12:22pm UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/8 "2022-03-21T12:22:23Z")

</div>

> [@zerocool2022](#):
>
> When I have a nested album such as CD1

Try %\_parent\_directory% instead of %\_directory%

> [@zerocool2022](#):
>
> I also want the to be added so that [FLAC-CD] is added to the album title.

My suggestion followed exactly what you said initially:

> [@zerocool2022](#):
>
> just my Identifier contained with in the brackets

ou could try:  
Format string: `%album% $regexp(%_directory%,'.*(\[.*\])',$1)`  
or  
Format string: `%album% $regexp(%_directory%,'.*\[(.*)\]','['$1']')`

---

<div class="post-metadata">

**Author:** ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)\
**Post date:** [February 9, 2026, 12:29pm UTC](https://community.mp3tag.de/t/add-tag-from-folder-name-to-metadata/56721/9 "2026-02-09T12:29:42Z")

</div>


