# How to import txt tracklist to file name?

**URL:** https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204
**Category:** Support
**Created:** [November 16, 2013, 7:02am UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204 "2013-11-16T07:02:24Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 16, 2013, 7:02am UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/1 "2013-11-16T07:02:24Z")

</div>

Hello,

I always download some music which without track number in the tag, and the files have no track number before the file name. it's just like "AAAAA", not "01 AAAAA".

So, I want to import the tracklist to file name,  
e.g.

I have files:  
AFFF  
BEEE  
CDDD  
DCCC  
EBBB  
FAAA

and i get the track list with track number:  
1 CDDD  
2 EBBB  
3 AFFF  
4 FAAA  
5 DCCC  
6 BEEE

How can I import the track list to file name with MP3tag?  
And make sure the tracks will match with the name and number.

I don't want to add track number one by one, coz some of the albums have a lot of tracks.

Thanks in advance!

---

<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: [November 16, 2013, 8:49am UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/2 "2013-11-16T08:49:56Z")

</div>

> [@pique](#):
>
> Hello, I always download some music which without track number in the tag, and the files have no track number before the file name. it's just like "AAAAA", not "01 AAAAA". So, I want to import the tracklist to file name ... and i get the track list with track number ... How can I import the track list to file name with MP3tag?  
> And make sure the tracks will match with the name and number. ...

At first your question looks as if it is easy to solve with the converter "Textfile - Tag".

But because the list file of "Track Filename" entries probably does not contain the filename as an absolute path name, then the converter "Textfile - Tag" can not afford the appropriate allocation between the current file and its related track number.

With the following action group, the problem is quickly finished.  
In Action #1 adapt the filepath location of the input text file to your needs.

Begin Action Group **Test\_2013#MatchFilenameInListfile.GiveTrack** 

Action #1  
_Actiontype 14:_ **Import text file**  
_Field \_\_:_ **TMP\_LIST**  
_Filename:_ **'T:\TEST\Tracklist.txt'**

 

Action #2  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_LIST**  
_Formatstring:_ **$regexp($char(13)$char(10)%TMP\_LIST%$char(13)$char(10),'\s\*[\r\n]+\s\*','\r\n')**

 

Action #3  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TMP\_FN**  
_Formatstring:_ **$regexp(%\_filename%,'[\*+?|{}()^$.#\]','\\$0')**

 

Action #4  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TRACK**  
_Formatstring:_ **$regexp(%TMP\_LIST%,'^._\n(\d+)\s+(__'%TMP\_FN%')\r._$****','$1')**

 

Action #5  
_Actiontype 5:_ **Format value**  
_Field \_\_\_\_\_\_:_ **TRACK**  
_Formatstring:_ **$if($eql(%TRACK%,%TMP\_LIST%),'0',%TRACK%)**

 

Action #6  
_Actiontype 9:_ **Remove fields**  
_Fields to remove (semicolon separated):_ **TMP\_LIST;TMP\_FN**

 

End Action Group **Test\_2013#MatchFilenameInListfile.GiveTrack** (6 Actions)

 

There is an archive file containing the test case.  
[20131117.pique.rar](https://community.mp3tag.de/uploads/default/original/2X/e/ebc00d512f57cc336dd93b7e49529bf3fb1503c2.rar) (2.5 KB)  
DD.20131116.1118.CET  
DD.20131117.1305.CET  
DD.20131117.1510.CET

 

[20131117.pique.rar](https://community.mp3tag.de/uploads/default/original/2X/e/ebc00d512f57cc336dd93b7e49529bf3fb1503c2.rar) (2.5 KB)

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 16, 2013, 12:15pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/3 "2013-11-16T12:15:16Z")

</div>

> [@DetlevD](#):
>
> At first your question looks as if it is easy to solve with the converter "Textfile - Tag".
> 
> But because the list file of "Track Filename" entries probably does not contain the filename as an absolute path name, then the converter "Textfile - Tag" can not afford the appropriate allocation between the current file and its related track number.
> 
> With the following action group, the problem is quickly finished.  
> In Action #1 adapt the filepath location of the input text file to your needs.
> 
> Begin Action Group **MatchFilenameInListfile.GiveTrack** 
> 
> Action #1  
> _Actiontype 14:_ **Import text file**  
> _Field \_\_:_ **TMP\_LIST**  
> _Filename:_ **'T:\TEST\Tracklist.txt'**
> 
>  
> 
> Action #2  
> _Actiontype 5:_ **Format value**  
> _Field \_\_\_\_\_\_:_ **TMP\_LIST**  
> _Formatstring:_ **$regexp($char(13)$char(10)%TMP\_LIST%$char(13)$char(10),'[\r\n]+','\r\n')**
> 
>  
> 
> Action #3  
> _Actiontype 5:_ **Format value**  
> _Field \_\_\_\_\_\_:_ **TRACK**  
> _Formatstring:_ **$regexp(%TMP\_LIST%,'^._\n(\d+)\s+(__'%\_filename%')\r._$****','$1')**
> 
>  
> 
> Action #4  
> _Actiontype 9:_ **Remove fields**  
> _Fields to remove (semicolon separated):_ **TMP\_LIST**
> 
>  
> 
> End Action Group **MatchFilenameInListfile.GiveTrack** (4 Actions)
> 
>  
> 
> There is an archive file containing the test case.  
> Attachment 5312 not found.
> 
>  
> 
> DD.20131116.1118.CET

Thank you very much!!! You helped me out!  
Have a nice day 🙂

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 17, 2013, 7:13am UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/4 "2013-11-17T07:13:04Z")

</div>

Hello,

I found a problem about the action 3:

If there're some special letters in the tracklist, such as "(", ")" etc...  
There will be a problem of this action.  
The track number will show all the track list.

Thank you.

---

<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: [November 17, 2013, 11:08am UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/5 "2013-11-17T11:08:52Z")

</div>

> [@pique](#):
>
> Hello, I found a problem about the action 3 ...

Thank you for pointing this out.  
See changes above in post #2 ...  
[How to import txt tracklist to file name?](https://community.mp3tag.de/t/15204/2)

DD.20131117.1309.CET

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 17, 2013, 12:18pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/6 "2013-11-17T12:18:16Z")

</div>

> [@DetlevD](#):
>
> Thank you for pointing this out.  
> See changes above in post #2 ...  
> [How to import txt tracklist to file name?](https://community.mp3tag.de/t/15204/2)
> 
> DD.20131117.1309.CET

Thank you.

But I think there's still a problem. And I don't know what is the problem.  
Just some of the files are not ok.

Please check the file. 🙂

[20131117.pique\_\_\_2.zip](https://community.mp3tag.de/uploads/default/original/2X/f/ff35205ae2773d44169b6c1eee92f228560698b3.zip) (2.76 KB)

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 17, 2013, 12:47pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/7 "2013-11-17T12:47:24Z")

</div>

Hello again,

Check this one, I think it's more clear.

[20131117.pique\_3.zip](https://community.mp3tag.de/uploads/default/original/2X/9/9311e26b73570784409a64b4c25ad2bb95b1975a.zip) (2.76 KB)

---

<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: [November 17, 2013, 12:54pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/8 "2013-11-17T12:54:08Z")

</div>

> [@pique](#):
>
> Hello again,Check this one, I think it's more clear.

The spelling is different:  
Selling Rope (Swan Dive to Estuary)  
Selling Rope (Swan Dive To Estuary)

Here is a case insensitive version ...  
[MatchFilenameInListfileCaseInsensitive.rar](https://community.mp3tag.de/uploads/default/original/2X/0/0f1b4350db54c6d8b0ace33ec7a40fc011b66449.rar) (999 Bytes)  
DD.20131117.1622.CET

[MatchFilenameInListfileCaseInsensitive.rar](https://community.mp3tag.de/uploads/default/original/2X/0/0f1b4350db54c6d8b0ace33ec7a40fc011b66449.rar) (999 Bytes)

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 17, 2013, 1:22pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/9 "2013-11-17T13:22:45Z")

</div>

> [@DetlevD](#):
>
> The names are different:  
> Selling Rope (Swan Dive to Estuary)  
> Selling Rope (Swan Dive To Estuary)
> 
> DD.20131117.1453.CET

OMG... Thanks... I didn't see that.

I'll be more careful.

Thanks again! 🙂

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 18, 2013, 6:13pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/10 "2013-11-18T18:13:52Z")

</div>

> [@DetlevD](#):
>
> The spelling is different:  
> Selling Rope (Swan Dive to Estuary)  
> Selling Rope (Swan Dive To Estuary)
> 
> Here is a case insensitive version ...  
> [MatchFilenameInListfileCaseInsensitive.rar](https://community.mp3tag.de/uploads/default/original/2X/0/0f1b4350db54c6d8b0ace33ec7a40fc011b66449.rar) (999 Bytes)  
> DD.20131117.1622.CET

Hello, first of all, thanks for the help.

But it seems still have problem. When the file names don't match, the track numbers will be wrong. It just show "0".

Or maybe we can do it in this way:

Just replace the filename and the title IF the words matches, no matter it's uppercase or lowercase. Then add the track number in the track tag. Since the names have all matched, it will be easy to get the track numbers.

Just a suggestion, hope it will help.

Thanks anyway. 🙂

---

<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: [November 18, 2013, 6:49pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/11 "2013-11-18T18:49:13Z")

</div>

> [@pique](#):
>
> ... When the file names don't match, the track numbers will be wrong. It just show "0". ...  
> ... Just replace the filename and the title IF the words matches, no matter it's uppercase or lowercase. Then add the track number in the track tag. Since the names have all matched, it will be easy to get the track numbers. ...

Hm, I do not understand ... does it mean, that "MatchFilenameInListfileCaseInsensitive" does not work?  
If the number '0' is irritating, you may replace the number '0' with the space character or leave the TRACK field just empty.

**$if($eql(%TRACK%,%TMP\_LIST%),,%TRACK%)**

DD.20131118.2050.CET

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 18, 2013, 7:47pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/12 "2013-11-18T19:47:47Z")

</div>

> [@DetlevD](#):
>
> Hm, I do not understand ... does it mean, that "MatchFilenameInListfileCaseInsensitive" does not work?  
> If the number '0' is irritating, you may replace the number '0' with the space character or leave the TRACK field just empty.
> 
> **$if($eql(%TRACK%,%TMP\_LIST%),,%TRACK%)**
> 
> DD.20131118.2050.CET

I think it doesnt work. If the file name in the tracklist doesn't match with the file name I have in my computer, when I do the action group, the track number will be written an "0".  
The others which names matched will be OK.

Thank you.

---

<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: [November 19, 2013, 7:28am UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/13 "2013-11-19T07:28:47Z")

</div>

> [@pique](#):
>
> ... If the file name in the tracklist doesn't match with the file name I have in my computer, when I do the action group, the track number will be written an "0". The others which names matched will be OK. ...

Hm, yes, you have described exactly the principle of matching.  
Therefore the TRACK '0' can be a mark for you to check the spelling of the related filename.

DD.20131119.0929.CET

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 19, 2013, 8:17am UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/14 "2013-11-19T08:17:28Z")

</div>

> [@DetlevD](#):
>
> Hm, yes, you have described exactly the principle of matching.  
> Therefore the TRACK '0' can be a mark for you to check the spelling of the related filename.
> 
> DD.20131119.0929.CET

OK, Thank you.

That will be an idea to check if the names are right. 🙂

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 19, 2013, 3:33pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/15 "2013-11-19T15:33:25Z")

</div>

> [@DetlevD](#):
>
> Hm, yes, you have described exactly the principle of matching.  
> Therefore the TRACK '0' can be a mark for you to check the spelling of the related filename.
> 
> DD.20131119.0929.CET

Hello, sorry to bother again.

I found it's just like earlier, when there're some special letters like: (, ), $, @ and letters from some other languages (French, germany and etc), the track numbers will show empty. Even the names match.

I mentioned the "0", because I added "tag - filename" to the end of this action, that's why it shows "0", the real reason is the track number tag is empty.

Thank you very much for all the help.

---

<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: [November 19, 2013, 4:03pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/16 "2013-11-19T16:03:04Z")

</div>

> [@pique](#):
>
> Hello, sorry to bother again.  
> I found it's just like earlier, when there're some special letters like: (, ), $, @ and letters from some other languages, the track numbers will show "0" too. Even the names match. Thank you very much for all the help.

Please give some more examples of your mystery names.  
The already escaped characters "$()" should work in the given regular expression.  
The symbol @ should also make no harm.  
The comma might hurt, so put it in the list of escaped characters too:

**$regexp(%TMP\_FN%,'[\\\*\+\?\|\{\}\[\]\(\)\^\$\.\,\#\ ]','\\\\$0')**

Alternatively you may try this expression, which escapes each character.

**$regexp(%TMP\_FN%,'.','\\\\$0')**

DD.20131119.1809.CET

---

<div class="post-metadata">

### Author: ![jackantony](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jackantony](https://community.mp3tag.de/u/jackantony)
#### Post date: [November 20, 2013, 7:05pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/17 "2013-11-20T19:05:16Z")

</div>

> [@DetlevD](#):
>
> Please give some more examples of your mystery names.  
> The already escaped characters "$()" should work in the given regular expression.  
> The symbol @ should also make no harm.  
> The comma might hurt, so put it in the list of escaped characters too:
> 
> **$regexp(%TMP\_FN%,'[\\\*\+\?\|\{\}\[\]\(\)\^\$\.\,\#\ ]','\\\\$0')**
> 
> DD.20131119.1809.CET

Thank you, I will take a note next time when I get the problem and give you an example.

Have a nice day! 🙂

---

<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:24pm UTC](https://community.mp3tag.de/t/how-to-import-txt-tracklist-to-file-name/15204/18 "2026-02-09T12:24:45Z")

</div>


