# Rename files from text file

**URL:** <https://community.mp3tag.de/t/rename-files-from-text-file/60631>\
**Category:** Support\
**Created:** [April 5, 2023, 1:32pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631 "2023-04-05T13:32:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![RayD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rayd/32/13683_2.png) [@RayD](https://community.mp3tag.de/u/RayD)\
**Post date:** [April 5, 2023, 1:32pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/1 "2023-04-05T13:32:33Z")

</div>

That worked. Thanks. Now I have another challenge. I have a list of filenames in the following format:  
01 - The Surfaris  
02 - The New Dimensions  
03 - The Beach Boys  
There are 30 filenames. I would like to use the convert text file - tag to change the filenames. I have examined the documentation to do that and I have tried it without success. Here is what I have tried so far:  
$num(%track%,2). %title%  
$num(%track%,5). %title%  
%track%  
None of these work. Please advise what I am doing wrong.

---

<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:** [April 5, 2023, 2:00pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/2 "2023-04-05T14:00:25Z")

</div>

> [@RayD](#):
>
> convert text file - tag to change the filenames

What is the contents of the text file?  
But in general: you can only rename files with Convert\>Tag-Filename or functions that can access \_FILENAME.  
To rename files from a list in a text file you need to import that data into a tag field first and then use the contents of that tag field in the named functions.

---

<div class="post-metadata">

**Author:** ![RayD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rayd/32/13683_2.png) [@RayD](https://community.mp3tag.de/u/RayD)\
**Post date:** [April 5, 2023, 6:01pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/3 "2023-04-05T18:01:51Z")

</div>

I have a text file containing file names. Each file name begins on a new line. I have a list of mp3 music files open in MP3TAG. What I want to do is import the file names from the text file into the Filename field of my mp3 files. How do I do that?

---

<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:** [April 5, 2023, 6:03pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/4 "2023-04-05T18:03:56Z")

</div>

as I said: you first have to import the data from the text file to a (user-defined? dummy?) tag field.  
Then you trigger either an action or the Convert\>Tag-Filename function to rename the files.

---

<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:** [April 5, 2023, 6:16pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/5 "2023-04-05T18:16:33Z")

</div>

> [@RayD](#):
>
> 01 - The Surfaris  
> 02 - The New Dimensions  
> 03 - The Beach Boys

If this is the list of filenames and it's in the format `TRACK - TITLE`, you could also simply import the data to the respective fields via

`%track% - %title%`

> Note that the `$num()` scripting function isn't available at importing from text files.

After that, you can use **Convert → Tag - Filename** with

`$num(%track%,2) - %title%`

to rename the files to match the contents of the text file.

---

<div class="post-metadata">

**Author:** ![RayD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rayd/32/13683_2.png) [@RayD](https://community.mp3tag.de/u/RayD)\
**Post date:** [April 5, 2023, 6:35pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/6 "2023-04-05T18:35:21Z")

</div>

When I ripped my music CD to my hard drive, here is what I wound up with:  
Filename Title  
01 Track 01.mp3 Sisters of Mercy  
The MP3 files already have titles as you can see from above example but the filename is wrong. I want to import only the filenames from text file. How do I do that?

---

<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:** [April 5, 2023, 6:38pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/7 "2023-04-05T18:38:41Z")

</div>

> [@RayD](#):
>
> The MP3 files already have titles as you can see from above example but the filename is wrong. I want to import only the filenames from text file

You can skip the text file part then and rename directly from the titles in the MP3s:

> [@Florian](#):
>
> After that, you can use **Convert → Tag - Filename** with
> 
> `$num(%track%,2) - %title%`

---

<div class="post-metadata">

**Author:** ![RayD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/rayd/32/13683_2.png) [@RayD](https://community.mp3tag.de/u/RayD)\
**Post date:** [April 5, 2023, 8:28pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/8 "2023-04-05T20:28:08Z")

</div>

Somehow I am not adequately expressing what I want to to. Referring to the following example, I would like the Filename field to be 01 - Sisters of Mercy.  
Filename Title  
01 Track 01.mp3 Sisters of Mercy  
. .  
. .  
. .  
29 Track 29.mp3 Cloudy Days  
I would like toe Filenames to be Title prefixed with "01 - " through "29 - "  
I have a text file with 01- Sisters of Mercy through 28 - Cloudy Days, one entry per line. I would like to replace the Filename field with the entries in my text file.

---

<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:** [April 5, 2023, 8:34pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/9 "2023-04-05T20:34:26Z")

</div>

> [@RayD](#):
>
> 01 Track 01.mp3 Sisters of Mercy

To get from that data and fill the tag data I suggest  
Convert\>Filename-Tag  
Mask: %track% Track %dummy%  
to get just the track number into the field track.  
As you have already date in TITLE:

> [@RayD](#):
>
> Sisters of Mercy

You can then apply Convert\>Tag-Filename with  
Format string: $num(%track%,2) - %title%

If you still insist on your approach with the data in the text file (which is more complicated IMHO), then have a look at the documentation:

> **[Import Tags from Text Files – Mp3tag Documentation](https://docs.mp3tag.de/converters/import-tags-from-text-files/)**
>
> Documentation on Text File to Tag, a converter to import tags from text files. Mp3tag is the universal Tag Editor.

---

<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:** [May 5, 2023, 8:34pm UTC](https://community.mp3tag.de/t/rename-files-from-text-file/60631/10 "2023-05-05T20:34:51Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
