# Rename tags from filename

**URL:** https://community.mp3tag.de/t/rename-tags-from-filename/47241
**Category:** General Discussion
**Created:** [December 7, 2019, 3:27pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241 "2019-12-07T15:27:15Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 3:27pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/1 "2019-12-07T15:27:15Z")

</div>

Please help, write a rename line, there is the following file structure

|Ayreon  
............|2013 - The Theory of Everything (Limited Edition)  
...........................................................................................|CD1 - Phase I׃ Singularity ⁄ Phase II׃ Symmetry

I want using folder names rename tags in tracks

Artist: Ayreon  
Year: 2013  
Album: The Theory of Everything (Limited Edition) (Phase I׃ Singularity ⁄ Phase II׃ Symmetry)  
DiskNumber: 01

Explanations - the name of the subfolder should be included in the name of the album in brackets, with the exception of "CD1 - "

"CD1 - " should be in the drive number, except "CD1" and " - "

clear task?

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

and second option

Artist: Ayreon  
Year: 2013  
Album: The Theory of Everything (Limited Edition) (CD1 - Phase I׃ Singularity ⁄ Phase II׃ Symmetry)

that is, just add the name of the subfolder to the album name and put it in brackets

option _%artist%%year% - %album%'('%album%')'%dummy%_ does not work

when you remove the brackets it adds

---

<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: [December 7, 2019, 4:46pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/2 "2019-12-07T16:46:19Z")

</div>

There is a "howTo" in the FAQs that describes how to import data from the folder structure:

> [@Converters to rename files or to import tags](https://community.mp3tag.de/t/converters-to-rename-files-or-to-import-tags/8016/3):
>
> How to import parts of the filename into the tag? Importing tags from filenames and directory names can be done by using the [Converter \> Filename - Tag] Converter \> Filename - Tag. The basic concept is the notion of a format string which describes the structure of the name to import from. The format string is built of either standard text (e.g., Music), placeholders (such as %artist%, %title%, ...), or backslash characters \ that denote directory structures. Here is an example that imports t…

> [@Mrakobes666](#):
>
> |Ayreon  
> ............|2013 - The Theory of Everything (Limited Edition)  
> ...........................................................................................|CD1 - Phase I׃ Singularity ⁄ Phase II׃ Symmetry

could be imported with  
Format string: `%artist%\%year% - %album%\CD%discnumber% - %myalbum%`  
If you want to have a special format in a field that you have to modify that field after you have imported the data.  
If the data is split across the full filename, use a helper field like %myalbum% and merge it after import with an action of the type "Format value" or Convert\>Tag-Tag for the target field ALBUM with the  
Format string: `%album% (%myalbum%)`

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 5:07pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/3 "2019-12-07T17:07:11Z")

</div>

thanks for the help CD%discnumber% it works

I can not put in brackets

_**%artist%%year% - %album%\CD%discnumber% - '('%album%')'%dummy%**_

shielding apostrophes don't help

---

<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: [December 7, 2019, 5:17pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/4 "2019-12-07T17:17:18Z")

</div>

You cannot use a string constant for 2 purposes:

- the separator
- part of a tag field

yet,

> [@Mrakobes666](#):
>
> `%artist%\%year% - %album%\CD%discnumber% - %album%)%dummy%`

may work so that you miss out only the closing bracket.  
You can add that with a second step e.g. Convert\>Tag-Tag for ALBUM  
Format string: %album%)

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 5:22pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/5 "2019-12-07T17:22:23Z")

</div>

I figured there was a one-way way to change tags (((

---

<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: [December 7, 2019, 5:28pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/6 "2019-12-07T17:28:44Z")

</div>

I just re-read the whole thread and I think that only the way with the user-defined field %myalbum% will lead to success.  
It will still be 2 steps, though.  
With the convert function you tell MP3tag how to separate an amorphous string into fields.  
It is not possible to add or modify the result with the same function.

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 5:44pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/7 "2019-12-07T17:44:32Z")

</div>

> [@ohrenkino](#):
>
> %album% (%myalbum%)

did according to yours, it turned out)))

where can I replace the forbidden characters:? / to unicode when renaming a file

$num(%track%,2). %title%

there is a colon in the tags, I want to replace it with unicode

I am read [Replace – Mp3tag Documentation](https://docs.mp3tag.de/actions/replace) do not understand

how Prologue: the Blackboard replace on Prologue׃ the Blackboard

second colons is unicode

where to insert the code $replace(,:,׃)

How to replace in a renamed track??

---

<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: [December 7, 2019, 6:09pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/8 "2019-12-07T18:09:03Z")

</div>

the colon is an invalid character for filenames as it is used for the drive letter

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 6:17pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/9 "2019-12-07T18:17:00Z")

</div>

yes, of course I’m in the know, so I use a replacement for a visually similar Unicode character that can be inserted into the file name

׃ - it is not a colon, it is a character, you can use it in the name. I want to replace the colon with this character.

Also with a slash / on ⁄

the answer is here, but not enough knowledge file:///C:/Portable%20App/Mp3tag/help/main\_scripting.html

---

<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: [December 7, 2019, 6:19pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/10 "2019-12-07T18:19:47Z")

</div>

If you know the character code, then use $char() instead of the visible character, e.g.  
`$replace(%title%,-,$char(32))`  
(which replaces the hyphen with a space character)

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 6:29pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/11 "2019-12-07T18:29:39Z")

</div>

in my opinion I am close to the answer, code symbol... 05C3

$replace(%title%,:,$char(05C3))

what should the string look like $num(%track%,2). %title%

---

<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: [December 7, 2019, 6:31pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/12 "2019-12-07T18:31:08Z")

</div>

combine both strings:  
`$num(%track%,2). $replace(%title%,:,$char(05C3))`

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 6:39pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/13 "2019-12-07T18:39:40Z")

</div>

and if there are several character substitutions, how should they be listed?

---

<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: [December 7, 2019, 6:41pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/14 "2019-12-07T18:41:22Z")

</div>

Follow this syntax:  
`$replace(%field% or string,search1,replace1,search2,replace2,...)`

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 6:44pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/15 "2019-12-07T18:44:34Z")

</div>

syntux is understandable instead `%title%` `%field%`

not a single code works, I tried several and the result is one - instead of a symbol in the name, a square

---

<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: [December 7, 2019, 6:47pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/16 "2019-12-07T18:47:59Z")

</div>

which means that the file system does not support UTF-16 characters....  
(it would be nice to see what you tried with the actual text - like that it is easier to reproduce or see a possible error)

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 6:54pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/17 "2019-12-07T18:54:20Z")

</div>

⁄

׃

here are their codes

2044

05C3

AC/DC \>\>\> AC ⁄ DC

---

<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: [December 7, 2019, 7:01pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/18 "2019-12-07T19:01:07Z")

</div>

You have to recalculate them to decimal value:  
2044 = $char(8260)  
5c03 = $char(1475)

---

<div class="post-metadata">

### Author: ![Mrakobes666](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/8797f3/32.png) [@Mrakobes666](https://community.mp3tag.de/u/Mrakobes666)
#### Post date: [December 7, 2019, 7:10pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/19 "2019-12-07T19:10:48Z")

</div>

its WORKS!!! and how offtopic how do you recalculate to decimal value? What kind of internet service?

---

<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: [December 7, 2019, 7:11pm UTC](https://community.mp3tag.de/t/rename-tags-from-filename/47241/20 "2019-12-07T19:11:59Z")

</div>

no internet required.  
You can use the Windows calculator in the mode for programmers.  
It usually starts in the mode "normal".

[Next page](https://community.mp3tag.de/t/rename-tags-from-filename/47241.md?page=2)
