Rename Files and Import Tags from Files

Mp3tag provides a variety of possibilities to get tag information from parts of the filename or to rename files based on the information stored in the tag of a file.

The base concept behind all converters in Mp3tag is the format string, which describes a pattern or template of a filename.

A format string consists of any characters and predefined placeholders or scripting functions. Every placeholder begins with the percent sign %, followed by a tag field name and ends with the percent sign.
For example, the placeholder %album% refers to the Album field.

Learn more about format strings in Format Strings and Available Placeholders and scripting functions in Scripting Functions

Rename Files

Rename Files based on Tags

Renaming files, creating folders and complete directory structures from tags can be done by using Convert → Tag - Filename with a format string. The format string is used to describe the structure of the desired filename.

Besides using normal placeholders (such as %artist%, %title%, ...) and arbitrary text (e.g., Music) it also allows for separating folders with the slash / character.

Here is an example that renames the file based on the tags using the Tracknumber. Title format:
$num(%track%,2). %title%

Please note, that the $num scripting function is used to ensure double-digit track numbers.

Create Folder Structures based on Tags

When you're using a slash character / in a format string, Mp3tag creates a folder from the part of the format string in front of a slash.

Here is an example that creates new directories under ~/Music/:
~/Music/$left(%artist%,1)/%artist%-%year%-%album%/$num(%track%,2). %title%

The same is also possible using relative path names (instead of an absolute path in the example above) which creates the new directory relative to the file the converter is applied to:
%artist%-%year%-%album%/$num(%track%,2). %title%

Import Tags from Files

Import Parts of the Filename to the Tag

Importing tags from filenames and directory names can be done by using Convert → Filename - Tag.

The format string describes the structure of the name to import from. It is built of either standard text (e.g., Music), placeholders (such as %artist%, %title%, ...), or slash characters / that denote folder structures.

Here is an example that imports tags from a file name 04. My Friend the Forest.mp3
%track%. %title%

Please note how the format string completely resembles the structure of the file name.

Sometimes you might want to omit some information that should not imported to the tag. This can be done using the %dummy% placeholder for the unneeded part of the file path.

Import Parts of the Folder Structure to the Tag

It's also possible to import information from the directory structure of the file path where the slash character is used to mark the different folders.

For example, the information from the path
Nils Frahm/[2018] All Meldoy/09 - Momentum.mp3
can be imported using
%artist%/[%year%] %album%/%track% - %title%

Import Tags from Text Files

Importing tags from text files can be done by using Convert → Text File - Tag. You can choose a specific file from your local drive, or you can use a Formatstring for the filename in case it should be derived from the first selected file.

The structure of the text file is basically one line per file. So the first line would contain the tags for the first file, the second line the tags for the second file, and so on.

As for the contents and structure of each line, Mp3tag uses a Formatstring to extract parts of the line to specific tag fields.

An example text file could look like:

87. Sigur Rós - [Ágætis byrjun #01] Intro
88. Sigur Rós - [Ágætis byrjun #02] Svefn-g-englar
98. Sigur Rós - [Ágætis byrjun #03] Starálfur

We probably want to omit the first number (which can be done via the %dummy% placeholder) and import the rest to the respective fields. A formatstring that resembles the structure would look like:

%dummy%. %artist% - [%album% #%track%] %title%