- Index
- Menus
- Convert
- Actions
- Export
- Scripting
- Filter
- Columns
- Options
- Donate

# Convert tags from/to filenames

- Tag - Filename
- Filename - Tag
- Filename - Filename
- Text file - Tag
- Tag - Tag

Mp3tag has a variety of possibilities to convert tags and file names.
Conversion means for example getting tag information from parts of the filename or renaming files based on the information stored in the tag of an audio file.

The base concept behind all converters in Mp3tag is the so called format string, which describes an abstract pattern of a filename or a line in a tag-list file.
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%' stands for the field Album in the tag at all converters.

This document gives a short introduction to the converters in Mp3tag. Please also try them, Mp3tag has an unlimited undo feature in case something is not like you would have expected it :-)

Back to main page

# Tag - Filename

Menu Convert > Tag - Filename

You can rename files based on the tag and file information with this converter.
The format string defines the format scheme of the new filename and all placeholders in this format string will be replaced with the information from the file when executing this converter.

Format string

The format string describes the filename scheme for the rename operation based on the tag and file information.
You can use the following placeholders:

`%album%` | Album
`%artist%` | Artist
`%comment%` | Comment
`%genre%` | Genre
`%title%` | Title
`%track%` | Track-Number
`%_total%` | Total number of tracks from xx/xx track-number field
`%year%` | Year
`%fieldname%` | Any other tag field not listed here with the name 'fieldname'. Please have a look at 'View > Extended Tags...' for an overview of all available tag fields in your file.

There are also some special fields, which give you some technical information about the file:

Technical Info |
`%_bitrate%` | Bitrate in kbit/s
`%_codec%` | Codec
`%_cover_mimetype%` | Mimetype of first cover art in the tag of the file
`%_cover_size%` | Size of first cover art in the tag of the file in bytes
`%_cover_type%` | Cover type of first cover art in the tag of the file
`%_covers%` | Count of cover art in the tag of the file
`%_id3v2_character_encoding%` | Encoding of the ID3v2 text frames of the file.
`%_length%` | Length (formatted)
`%_length_seconds%` | Length (in seconds)
`%_mode%` | Mode
`%_samplerate%` | Sample rate
`%_tag%` | Available tag types in file
`%_tag_read%` | Displayed tag type
`%_tag_size%` | Size of all tags in bytes
`%_tag_size_appended%` | Size of all appended tags in bytes
`%_tag_size_prepended%` | Size of all prepended tags in bytes
`%_tool%` | Additional codec information (not available for all supported audio formats).
`%_vbr%` | Bitrate type or compression profile
File name / path info |
`%_directory%` | Name of the parent directory
`%_extension%` | File extension
`%_filename%` | File name without extension
`%_filename_ext%` | File name with extension
`%_folderpath%` | Path without file name
`%_parent_directory%` | Name of the grandparent folder
`%_path%` | File name with path
`%_volume%` | Volume label
`%_workingdir%` | Name of current working directory
`%_workingpath%` | Path of current working directory
File properties |
`%_file_create_date%` | Short creation date
`%_file_create_datetime%` | Long creation date
`%_file_create_datetime_raw%` | Long creation date (unix timestamp)
`%_file_mod_date%` | Short modification date
`%_file_mod_datetime%` | Long modification date
`%_file_mod_datetime_raw%` | Long modification date (unix timestamp)
`%_file_size%` | File size in human readable format
`%_file_size_bytes%` | File size in bytes
`%_file_size_kb%` | File size in kilobytes
`%_file_size_mb%` | File size in megabytes
System |
`%_app%` | Mp3tag, e.g. Mp3tag v3.06a
`%_counter%` | Counter (starting with 1)
`%_date%` | Short date
`%_datetime%` | Long date
`%_total_files%` | Number of selected files

Examples

%artist% - %album% - $num(%track%,2) - %title% renames to Artist - Album - 01 - Title

%artist%\%album% '['%year%']'\$num(%track%,2). %title% creates Artist\Album [2010]\01. Title

Notes

You can use the backslash to mark directories in the format string.

You can use the built-in Scripting functions.

Back to main page

# Filename - Tag

Menu Convert > Filename - Tag

This converter takes parts from the filename and copies them to specified fields in the tag of the audio file. The format string defines the format of the filename and the placeholders are describing the way to which tag field the parts will be copied.

Format string

The format string describes the formatting scheme of the filename. The placeholders used mark the parts of the filename which are copied to the tag.
You can use the following placeholders in the format string:

`%album%` | Album
`%artist%` | Artist
`%comment%` | Comment
`%genre%` | Genre
`%title%` | Title
`%track%` | Track-Number
`%year%` | Year
`%dummy%` | this part will be ignored
`%fieldname%` | any field with name fieldname

Example

Filename: (Artist - Album) 01 EXAMPLE Year.mp3
Format string: `(%artist% - %album%) %track% EXAMPLE %year%`

Notes

You can use the backslash to mark directories in the format string.

Back to main page

# Filename - Filename

Menu Convert > Filename - Filename

This converter is a rename tool, which renames filenames based on the filename. You can define up to nine parts of the old filename and let Mp3tag organize the parts in a new way.

## Old filename pattern

This format string splits the filename in several parts. You can use the following placeholders:

`%1 first part
%2 second part
...
%9 last part
`

## New filename pattern

Format string which is a combination of the parts defined in the format string above.

Example

Old filename: (Artist - Album) 01 EXAMPLE 2004 (COMMENT).mp3
Old filename pattern: `(%1 - %2) %3 %4 %5 (%6)`
New filename pattern: `%5 (%1 - %2) Example '['%6']'`
New filename: 2004 (Artist - Album) Example [COMMENT].mp3

Notes

You can mark directories via the backslash within the format string. Please note that Mp3tag won't rename directories but will create new directories below the current working directory if you use backslashes within the new filename pattern.

You can use the built-in Scripting functions for the new filename (e.g. `$upper(%1)`).

Back to main page

# Text file - Tag

Menu Convert > Text file - Tag

This converter imports tag information from a text file. In this text file, each line corresponds to the tag information for one file. The format string describes the format of these lines.

Text files in Unicode format need a BOM (Byte Order Marker) to be correctly identified as Unicode files.

## Filename

Filename of the text file. The tags will be imported from this file.

## Format string

The format string describes the format of one line in the text file.
You can use the following placeholders in the format string:

`%album%` | Album
`%artist%` | Artist
`%comment%` | Comment
`%genre%` | Genre
`%title%` | Title
`%track%` | Track-Number
`%year%` | Year
`%field%` | Any other tag field from the list of supported tag fields
`%_filename_ext%` | Filename (current working directory is used as file path)
`%_path%` | Filename with full file path
`%dummy%` | this part will be ignored

Matching files from text file to file list in Mp3tag

`%_filename_ext%` or `%_path%` are used to ensure the correct file gets tagged. Use `%_filename_ext%` if you have lots of files in one folder. Use `%_path%` if you have many folders each containing files. If you do not use either of these tags, mp3tag will simply work through the text file one line at a time, applying changes to each selected file in turn. It is possible that tags will be applied to the wrong files if the selected files and the text file are in a different order.

Example

Line in file: Artist / Title / Album / Year
Format string: `%artist% / %title% / %album% / %year%`

This example uses `space-slash-space` as separator. Depending on your import file, you'd use the corresponding character sequence, e.g., `space-dash-space` `-` or a semicolon `;`.

Back to main page

# Tag - Tag

Menu Convert > Tag - Tag

This converter formats tag fields by other fields content, i.e., this converter can also be used for copying the content of one tag field to another tag field.
You can use placeholders for any tag field and scripting functions as format string to format the content of the field specified.

Back to main page

Made with love in Dresden. Copyright © 1999-2021 Florian Heidenreich. All rights reserved.