# "Filename - Tag" ICON

**URL:** https://community.mp3tag.de/t/filename-tag-icon/16549
**Category:** Support
**Created:** [January 31, 2015, 5:41pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549 "2015-01-31T17:41:52Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [January 31, 2015, 5:41pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/1 "2015-01-31T17:41:52Z")

</div>

Hello

I would like to now is there is a way to use the "Filename - Tag", so it would automatically change all "\_" characters from filename into "/" characters in the tag "title"?

I would also like to use the icon "Tag - Filename" other way around: that it would automatically change all "/" characters from "title" tag into "\_" characters in the filename?

---

<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: [January 31, 2015, 5:52pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/2 "2015-01-31T17:52:07Z")

</div>

I think you have to run an action after you have imported the data into the fields.  
Action of the type "Replace" for TITLE  
Search: \_  
Replace: /

For the tag-filename conversion, you can envelop the filename-mask with the $validate() function  
[https://docs.mp3tag.de/scripting/#string-functions](https://docs.mp3tag.de/scripting/#string-functions)  
$validate(%track% - %title%,\_)  
which takes care of any illegal character.

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 1, 2015, 4:06pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/3 "2015-02-01T16:06:23Z")

</div>

> [@ohrenkino](#):
>
> I think you have to run an action after you have imported the data into the fields.  
> Action of the type "Replace" for TITLE  
> Search: \_  
> Replace: /
> 
> For the tag-filename conversion, you can envelop the filename-mask with the $validate() function  
> [https://docs.mp3tag.de/scripting/#string-functions](https://docs.mp3tag.de/scripting/#string-functions)  
> $validate(%track% - %title%,\_)  
> which takes care of any illegal character.

Yes, I know this. I've already have a defined one in the actions groups

But that makes two additional clicks on another option- and I need to eliminate this, beacasue I'm going to do some major changes, which will sum up to hundreds if not thousands of additional click; and if I forget even once or miss something, that I will have an error

And aside that, this works only in one way: "Filename - Tag". Because if I run "Tag - Filename", all ":" and "/" signs are just left out and not put into filename [because you can't have signs like that in Windows OS]. And as I understand, this is where the "validate" comes into play [which you kindly suggest looking into]. But but that either doesn't apply to what I'm specifically looking for or I just don't understand that part of manual and don't see how to apply that information to practice. I've also looked for information at the [https://docs.mp3tag.de/actions/replace](https://docs.mp3tag.de/actions/replace) with same result / conclusion

---

<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 1, 2015, 4:49pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/4 "2015-02-01T16:49:31Z")

</div>

You can save the clicks if you create an action group that does the "extra steps" with one call.  
The Convert\>Filename-Tag function can be emulated by a "Guess value" (import tag field) action.  
Yes, you are right, that a "replace" action does almost the same thing as a $validate() only that you don't have to keep track of the special characters.  
And while the ordinary tag-filename conversion eliminates the illegal characters, you can use the $validate() to replace an illegal character with a substitute so that you can see where the illegal character was.

or coming back to your original question: no, there is no automatism.

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 2, 2015, 5:41pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/5 "2015-02-02T17:41:41Z")

</div>

Unfortunately, both the on-line manual and your explanations are understandable for me at some minimum level

I've managed to make a three step action group, which looks now like that

Format value "TITLE": %_filename%  
Replace "TITLE": ".." -\> ':"  
Replace "TITLE": "_" -\> '/"

And with this I have emulated the "Filename - Tag", with an addition of automatic correction of ".." and "\_" signs in the TITLE tag [and at the same time leaving them in filename]. That is an exact outcome which I was aiming for and with clicks limited to minimum. But to clarify:

**1]** What can I put in the "Filename - Tag" icon to make those exact same three things at once. Or is it just impossible?  
**2]** What can I put in the "Tag - Filename" icon to make an opposite set of action . Or is it just impossible?

[And if it is possible indeed, by "what can I put" a mean "what is the exact expression I should"; bacause I've tried writing proper "$validate(something,blah,blah)" and it felt flat]

---

<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 2, 2015, 6:03pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/6 "2015-02-02T18:03:07Z")

</div>

> [@zerow](#):
>
> ...  
> **1]** What can I put in the "Filename - Tag" icon to make those exact same three things at once. Or is it just impossible?

This is impossible. At least with the Convert\>Filename-tag function. You would have to use the actions that you have created as this action assigns data from an amorphous string to structured fields. So the data has to be in the fields first before you can replace anything.

> [@](#):
>
> **2]** What can I put in the "Tag - Filename" icon to make an opposite set of action . Or is it just impossible?...

It would have been easier to tell you the

> [@](#):
>
> exact expression

if you had told me the exact mask you use to create the filename.  
Provided, you want to get the TITLE as filename but only with legal characters for a filename and an underscore \_ for each illegal character then the mask for Convert\>Filename-Tag would look like this:  
$validate(%title%,\_)

Actually: there are more than just : and / to be avoided for filenames. ?\*"\<\>|: are also illegal. So once you have transformed the title back and forth, you will not find any ilegal characters in the title any more and you will not be able to backtrack which of the illegal characters was originally in the title.

In short: the messing about with replacements is not necessary if you declare the tags as master data and the filenames are just something that the file system has to deal with. From then on, only take care about the data in the tags. The filenames are of minor importance then.

---

<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 2, 2015, 6:05pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/7 "2015-02-02T18:05:42Z")

</div>

> [@zerow](#):
>
> ... I've tried writing proper "$validate(something,blah,blah)" and it felt

This is not the proper syntax ...  
$validate(something,blah,blah)

See Mp3tag Help Manual.  
The function $validate(filename,to) replaces all invalid characters, regarding the creation of filepathnames, with one dedicated character, chosen by the user.  
Some invalid characters are: **/?\*"\<\>|:**  
Example: **$validate(%ARTIST%' - '%ALBUM%' - '%TRACK%' - '%TITLE%,'\_')**  
Example: **$validate(%ARTIST%' - '%ALBUM%' - '%TRACK%' - '%TITLE%,)**

DD.20150202.2009.CET

See also ...  
[[F] $validate() broken?](https://community.mp3tag.de/t/8311/12)  
[Character remapping during conversion?](https://community.mp3tag.de/t/13037/5)

DD.20150202.2039.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 2, 2015, 6:27pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/8 "2015-02-02T18:27:20Z")

</div>

> [@zerow](#):
>
> Hello I would like to now is there is a way to use the "Filename - Tag", so it would automatically change all "\_" characters from filename into "/" characters in the tag "title"?

The purpose of the converter "Filename - Tag" is ... to split the file name into parts using a mask, ...  
and put the parts automagically into the corresponding tag-fields, which are defined by the given mask format string.

If you want to replace one or more characters in a string, ...  
then use the action "Replace" resp. the function $replace(), ...  
or use the advanced action "Replace using Regular Expression" resp. the function $regexp().

The functionality of the interactive converters can be replaced by action resp. action groups.

> [@zerow](#):
>
> I would also like to use the icon "Tag - Filename" other way around: that it would automatically change all "/" characters from "title" tag into "\_" characters in the filename?

With the help of the converter "Tag - Filename" it is possible to rename the selected files, based on the embedded tag information.

If you want to replace one or more characters in a string, ...  
then use the action "Replace" resp. the function $replace(), ...  
or use the advanced action "Replace using Regular Expression" resp. the function $regexp().

Example using action "Format value" and function $replace() ...

**\_FILENAME \<== $replace(%ARTIST%' - '%ALBUM%' - '$num(%TRACK%,2)' - '%TITLE%,'/','\_')**

Example for bijective mapping ...

**\_FILENAME \<== $replace(%TAGFIELD%,'/','\_',':.','...',':','..') TAGFIELD \<== $replace(%\_filename%,'\_','/','...',':.','..',':')**

DD.20150202.2027.CET, DD.20150203.1759.CET

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 3, 2015, 3:04pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/9 "2015-02-03T15:04:15Z")

</div>

So, for copying "filename" into "title" [with mandatory correction] I have to use groups, because whatever [because I didn't get the explanation the first 3 times I read it]

And to this previous solution of mine I've made and an error preventing **improvement** :

Format value "TITLE": %_filename%  
Replace "TITLE": ".." -\> ":"  
 **Replace "TITLE": ":." -\> "..."**  
Replace "TITLE": "_" -\> "/"

> [@ohrenkino](#):
>
> It would have been easier to tell you the exact expression if you had told me the exact mask you use to create the filename.

%title%

Is that what yo are asking? [For me, a mask is that thing from Photoshop]. I have only that in the "Tag - Filename" icon, which works by just omitting illegal characters. Which is not good enough

> [@ohrenkino](#):
>
> Provided, you want to get the TITLE as filename but only with legal characters for a filename and an underscore \_ for each illegal character then the mask for Convert\>Filename-Tag would look like this:  
> $validate(%title%,\_)

Yes, that's what I want, but not an underscore for every sign that is illegal for Windows, but an underscore for a specific illegal character

And that is why I am talking from the beginning about two characters  
:  
/  
Because I use them as a two separate examples [cases, problems] and because I can't have underscores running all over filenames [because I won't be precise enough]

> [@ohrenkino](#):
>
> Actually: there are more than just : and / to be avoided for filenames. ?\*"\<\>|: are also illegal. So once you have transformed the title back and forth, you will not find any ilegal characters in the title any more and you will not be able to backtrack which of the illegal characters was originally in the title.

That is the problem in the long shot and with thousands of files: the backtracking

That is way I've choosed a long time ago to "translate" illegal characters into legal

If I have an "/" in TITLE, a always use "\_" in filename  
If I have an ":" in TITLE, a always use ".." in filename  
etc.

So everytime I copy between filename and tag, I have a potential correction to make

> [@ohrenkino](#):
>
> In short: the messing about with replacements is not necessary if you declare the tags as master data and the filenames are just something that the file system has to deal with. From then on, only take care about the data in the tags. The filenames are of minor importance then.

Yes, filenames are mainly for system and tags are what really matters for concerned / serious users

But filenames are also the fail-secure: a sometimes used safety information. And that is why I came up with the translation system. And I have just to much of an empirical experience backing that up, to not to use it anymore

So now now I need to automate that system, to make it easier and more precise

As I understand, we have covered the "filename" ---) "title" way: I have to use groups [because whatever]

Now for the "title" ---) "filename" way: what do I put in "Tag - Filename"?; or will I also have to use groups? If I put

$replace(%title%,/,\_,)

it only works for the "/" sign; which is what I want. But that doesn't deal wit the rest of my "translation system". And if I put something like

$replace(%title%,/,\_,)(%title%,:,..,)

or

$replace(%title%,/,\_,:,..)

or

$replace((%title%,/,\_,)(:,..))

it just doesn't 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: [February 3, 2015, 5:21pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/10 "2015-02-03T17:21:51Z")

</div>

> [@zerow](#):
>
> ...  
> $replace(%title%,/,_,)(%title%,:,..,)  
> ...  
> $replace(%title%,/,_,:,..)  
> ...  
> $replace((%title%,/,\_,)(:,..))
> 
> it just doesn't work

But you are almost there: you can add a number of pairs:

$replace(%title%,/,\_,:,..,?,%)  
and so on. You may add further pairs for replacement.  
Please note that a filename has a certain maximum length which is usually shorter than the maximum field lengths.  
Also, if you want to have a decent backup storage for the tag data in the shape of a filename then you would have to add the contents of a couple of other fields to the filename and/or path.  
This backup system will probably not work for lyrics.  
So if you really want to keep a backup of the data then you may want to consider the Export functions which enable you to save data in a number of formats and which also can be imported again into the tags.

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 6, 2015, 12:27pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/11 "2015-02-06T12:27:46Z")

</div>

> [@ohrenkino](#):
>
> But you are almost there: you can add a number of pairs:
> 
> $replace(%title%,/,\_,:,..,?,%)  
> and so on. You may add further pairs for replacement.

Yes, I was so close in guessing what the combination should be

I've created now a second group for "title ---) filename" because if I have to use one for "filename ---) title", I should also use for the other way around, so that I don't accidentally click the "Filename - Tag" icon [which can't be altered to my needs] by the force of habbit:

Format value "_FILENAME": $replace(%title%,/,_,?,§,:,..,?,%)

And with that I have even the "translation" of the question mark into a paragraph sign, which i didn't expect to work, beacause of the question mark that has to be in the format string near it's end. So, thank you ohrenkino and DetlevD for the guidance

And just for future needs [to archivize on-line this ready-to-use knowledge], I shall now put once again the first action group:

Format value "TITLE": %_filename%  
Replace "TITLE": "§" -\> "?"  
Replace "TITLE": "_" -\> "/"  
Replace "TITLE": ".." -\> ":"  
Replace "TITLE": ":." -\> "..."

And as for the export options I only have one small question. Let's say I have 100 files and I export tags. If I new remove even only one file, won't it prevent me from importing the tags in the proper way [to the proper files]? I mean, if I delete file 50, then 51 becomes "50" [and automatically gets copy set of tags from 50 instead of 51]?

---

<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 6, 2015, 3:29pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/12 "2015-02-06T15:29:19Z")

</div>

> [@zerow](#):
>
> ... I export tags. If I ... remove even only one file, won't it prevent me from importing the tags in the proper way [to the proper files]? ...

If each export data line within a CSV export text file, contains a field with the value from **%\_path%** , then, while importing the CSV data, Mp3tag takes this path value as a link or reference to the existing file.  
If there is no match, then Mp3tag displays a message, about the failing file.

DD.20150206.1729.CET

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 9, 2015, 7:38pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/13 "2015-02-09T19:38:58Z")

</div>

I thought ths topic was over, but there is a problem with the " sign in title tag

If I use

$replace(%title%,/,\_,?,§,:,..,",'',?,%)

it makes three first "translatons" correct, but the last one makes " sign into a single ' sign, instead of '' [double apostrophe]

And if I use

$replace(%title%,/,\_,?,§,:,..,",''',?,%)

all I get as a filename is a

[SYNTAX ERROR IN FORMATTING STRING]

and not '' [double] or ''' [triple] apostrophe

---

<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 9, 2015, 7:44pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/14 "2015-02-09T19:44:39Z")

</div>

try  
$replace(%title%,/,\_,?,§,:,..,",'''',?,%)

---

<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 9, 2015, 7:54pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/15 "2015-02-09T19:54:46Z")

</div>

> [@zerow](#):
>
> ... If I use  
> $replace(%title%,/,\_,?,§,:,..,",'',?,%)  
> it makes three first "translatons" correct, but the last one makes " sign into a single ' sign, instead of '' [double apostrophe] ...

In Mp3tag the single apostrophe is a special character, because it is the string delimiter.  
If you want to see one single apostrophe, you have to write two single apostrophes,  
... noted in the Mp3tag help manual.

DD.20150209.2154.CET

---

<div class="post-metadata">

### Author: ![Zerow](https://community.mp3tag.de/user_avatar/community.mp3tag.de/zerow/32/11379_2.png) [@Zerow](https://community.mp3tag.de/u/Zerow)
#### Post date: [February 9, 2015, 8:32pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/16 "2015-02-09T20:32:20Z")

</div>

> [@ohrenkino](#):
>
> try  
> $replace(%title%,/,\_,?,§,:,..,",'''',?,%)

Yes, that works

Just don't undestand why when 2 gives 1, the 3 don't give 2 but an error [and you have jump over it and go a step further to 4, to be given 2]. But that that doesn't matter

---

<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 10, 2015, 7:25am UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/17 "2015-02-10T07:25:49Z")

</div>

> [@zerow](#):
>
> ... Just don't undestand why when 2 gives 1, the 3 don't give 2 but an error [and you have jump over it and go a step further to 4, to be given 2]. But that that doesn't matter

This is simple math ...  
3 is the sum of 2 plus 1 ...  
... this is an odd number and a syntax error regarding the rule for single apostrophe in Mp3tag.  
4 is the sum of 2 plus 2 ...  
... this is an even number and the correct syntax regarding the rule for single apostrophe in Mp3tag.  
... so ...

**'this is a string'**... but ... **''** (two single apostrophes) ...

... this is not an empty string, but one single apostrophe.

DD.20150210.0925.CET

---

<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:25pm UTC](https://community.mp3tag.de/t/filename-tag-icon/16549/18 "2026-02-09T12:25:30Z")

</div>


