# Actions and batch-operations

**URL:** https://community.mp3tag.de/t/actions-and-batch-operations/967
**Category:** FAQ (Frequently Asked Questions)
**Created:** [April 16, 2004, 7:46am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967 "2004-04-16T07:46:06Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 7:46am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/1 "2004-04-16T07:46:06Z")

</div>

Mp3tag provides a variety of actions, which can be applied to filenames and tags. The actions are grouped together into named sets (action groups), which can be applied independently via Alt + 6. If you do not want to create a reusable action group for applying one single action, the Actions (Quick) toolbar button or keyboard shortcut Shift + Alt + 6 can be used.

### How to [create a new action](https://community.mp3tag.de/t/actions/967/2)?

### How to ...

- [change upper/lower case of tag fields or filenames](https://community.mp3tag.de/t/actions/967/3)?
- [replace the string “xyz” in tag-fields or filenames](https://community.mp3tag.de/t/actions/967/4)?
- [append the string " xyz" to the content of a tag field](https://community.mp3tag.de/t/actions/967/5)?
- [remove text strings](https://community.mp3tag.de/t/actions/967/6)?
- [add additional spaces around dash](https://community.mp3tag.de/t/actions/967/7)?
- [remove a certain number of leading chars](https://community.mp3tag.de/t/actions/967/8)?
- [remove specific leading characters](https://community.mp3tag.de/t/actions/967/9)?
- [remove/trim leading and trailing spaces](https://community.mp3tag.de/t/actions/967/10)?
- [remove/trim leading track numbers](https://community.mp3tag.de/t/actions/967/11)?
- [separate or split strings that are written in one word](https://community.mp3tag.de/t/actions/967/12)?
- [apply upper case after an O’ (like O’Hugo)](https://community.mp3tag.de/t/actions/967/13)?
- [swap the contents of 2 tag fields](https://community.mp3tag.de/t/actions/967/14)?
- [copy one field value to another field](https://community.mp3tag.de/t/actions/967/15)?
- [organize actions](https://community.mp3tag.de/t/actions/967/16)?

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 8:22am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/2 "2004-04-16T08:22:04Z")

</div>

### How to create a new action?

First, create a new action group via Actions \> ![Actions](https://community.mp3tag.de/uploads/default/original/1X/318aa654f7a0c7c178d869991f6e8680b214cfc0.png "Actions") Actions or Alt + 6.

Then, click on the button ![New](https://community.mp3tag.de/uploads/default/original/1X/ec5caa1b5d6c43fd0fe30efd3515a713a18c5105.png "New") New and give your action group an expressive name, e.g., "_All tag fields Upper Case_". This action group can be applied to the selected files after you have added one or more actions to it.

Now, you can create a new action in your action group via the button ![New](https://community.mp3tag.de/uploads/default/original/1X/ec5caa1b5d6c43fd0fe30efd3515a713a18c5105.png "New") New and choose the desired action type from the list.

At the moment the following action types are available

- [Adjust cover](https://docs.mp3tag.de/actions/adjust-cover)
- [Case conversion](https://docs.mp3tag.de/actions/case-conversion)
- [Convert codepage](https://docs.mp3tag.de/actions/convert-codepage)
- [Export](https://docs.mp3tag.de/actions/export)
- [Export cover to file](https://docs.mp3tag.de/actions/export-cover)
- [Format value](https://docs.mp3tag.de/actions/format)
- [Guess values](https://docs.mp3tag.de/actions/guess)
- [Import cover from file](https://docs.mp3tag.de/actions/import-cover)
- [Import text file](https://docs.mp3tag.de/actions/import-text)
- [Merge duplicate fields](https://docs.mp3tag.de/actions/merge-duplicate-fields)
- [Remove duplicate tag fields](https://docs.mp3tag.de/actions/remove-duplicate-fields)
- [Remove fields](https://docs.mp3tag.de/actions/remove-fields)
- [Remove fields except](https://docs.mp3tag.de/actions/remove-fields-except)
- [Replace](https://docs.mp3tag.de/actions/replace)
- [Replace with regular expression](https://docs.mp3tag.de/actions/replace-regexp)
- [Split fields by separator](https://docs.mp3tag.de/actions/split-field)

You can combine different actions (e.g., Case conversion and Replace) in one action group and activate or deactivate them via the checkmarks in the Actions \> ![Actions](https://community.mp3tag.de/uploads/default/original/1X/318aa654f7a0c7c178d869991f6e8680b214cfc0.png "Actions") Actions dialog.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 8:40am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/3 "2004-04-16T08:40:54Z")

</div>

### How to change upper/lower case of tag fields or filenames?

Create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group and choose Case conversion as action type.

- **Field** determines which parts of the tags/filename should be changed.
- **Case conversion** determines how the upper/lower case of the field will be changed.

If you want for example mark chars after a left parenthesis or a hyphen as the begin of a word, enter the respective char under **Words begin from/after any of**.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 9:09am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/4 "2004-04-16T09:09:19Z")

</div>

### How to replace the string "xyz" in tag-fields or filenames?

Create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group and choose Replace as action type.

- **Field** specifies the parts of the tags/filename the replace rule should be applied to.
- **Original** is the string that is going to be changed in **Field**.
- **Replace with** is the string that replaces the string in **Original**. If you leave it empty, the string will be deleted.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 9:20am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/5 "2004-04-16T09:20:56Z")

</div>

### How to append the string " xyz" to the content of a tag field?

Create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group and choose Format value as action type.

- **Field** specifies the tag field the formatting rule should be applied to.
- **Format string** must have the field placeholder for the field selected above and the string which should be appended.

**Example:**  
If you want to append the string " xyz" to the current value of the comment field:

_Action type:_ **Format value**  
_Field:_ **COMMENT**  
_Format string:_ **%comment% xyz**

You can use this also to add "xyz " in front of the tag value, combine fields or to copy one value to another field.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 10:50am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/6 "2004-04-16T10:50:01Z")

</div>

### How to remove text strings?

In order to remove text strings, create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group and choose Replace as action type.

- **Field** : Here you can enter which field(s) you want to change.  
You can choose

- **Original** : Here you enter the string that you want to delete.

- **Replace with** : Just leave this empty, because you're going to delete the string in **Original**.

**Example:**  
Assume that you want to remove _Obsolete_ from the filename _ThisShouldRemainObsolete_ so that _ThisShouldRemain_ is the result. To achieve that, just enter _Obsolete_ at **Original**.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 11:28am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/7 "2004-04-16T11:28:23Z")

</div>

### How to add additional spaces around dash?

In order to get better readability for a filename like "Artist&nbsp;-&nbsp;Title", you can add spaces so that it reads "Artist&nbsp;&nbsp;-&nbsp;&nbsp;Title"

Create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group, choose Replace as action type and enter (without the quotes):

- **Field** : \_FILENAME
- **Original** : " - "
- **Replace with** : "&nbsp;&nbsp;-&nbsp;&nbsp;"

You can activate the action group via Convert, ![Actions](https://community.mp3tag.de/uploads/default/original/1X/318aa654f7a0c7c178d869991f6e8680b214cfc0.png "Actions") Actions and apply it to the selected files.

Unintended duplication of spaces can occur, if you're executing this action several times. "x&nbsp;-&nbsp;x" becomes "x&nbsp;&nbsp;-&nbsp;&nbsp;x", and "x&nbsp;&nbsp;-&nbsp;&nbsp;x" becomes "x&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;x" etc. You can prevent this by adding a second action that makes "&nbsp;&nbsp;&nbsp;" (3 spaces) to "&nbsp;&nbsp;" (2 spaces).

It is even more simple if your files are already properly tagged: you can use the converter ![Tag - Filename](https://community.mp3tag.de/uploads/default/original/1X/922db76db5d45b2e558d10f3d8c25fb8bc04fd27.png "Tag - Filename") Tag - Filename with the format string **"%artist%&nbsp;&nbsp;-&nbsp;&nbsp;%title%"** and get the same result.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 1:32pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/8 "2004-04-16T13:32:16Z")

</div>

### How to remove a certain number of leading chars?

In order to remove some leading characters from the filename or a tag field, create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group and choose Replace with regular expression as action type.

- **Field** : choose where you want to remove the chars.
- **Regular expression** : enter **`^.{3}`** if you want to remove 3 chars.
- **Replace matches with** stays empty.

You can enter the number of chars to be removed between the two curly brackets.

To remove the last 3 characters use **`.{3}$`** (but do not use this on \__FILENAME_ as it would remove the file extension).

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 2:05pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/9 "2004-04-16T14:05:46Z")

</div>

### How to remove specific leading characters?

Some titles start with "The", others with "Der" or "Die". Mass-deleting the first 3 characters doesn't have the desired result, because all other tags/filenames will be shortened too.

To remove specific leading chars, create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group and choose Replace with regular expression as action type.

- **Field** : choose where you want to remove the chars.
- _Regular expression_\*: enter **`^The\s+`**
- **Replace matches with** stays empty.

If you execute this action on your selected files, all **`The`**'s and following spaces will be deleted. Of course, it works the same way with any other word.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 3:53pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/10 "2004-04-16T15:53:04Z")

</div>

### How to remove/trim leading and trailing spaces

**[Video tutorial for these actions](http://www.vimeo.com/7756545)**

#### Leading spaces:

Action type: Replace with regular expressions  
Field: **\_TAG**  
Regular expression: **`^\s+`**  
Replace matches with:

**`^`** matches the beginning of the string. Then **`\s+`** searches for all whitespaces till a different char occurs.  
The whitespaces found will be replaced by nothing and, thus, deleted.

#### Trailing spaces:

Action type: Replace with regular expressions  
Field: **\_TAG**  
Regular expression: **`\s+$`**  
Replace matches with:

This regular expression matches one and more (marked by **`+`** ) spaces (marked by the **`\s`** specifier) at the end (marked by **`$`** ) of a string.

#### Trailing spaces from filenames:

An action that doesn't remove the file extension:

Action type: Format value  
Field: **\_FILENAME**  
Formatstring: **`$trim(%_filename%)`**

#### Cut two or more consecutive spaces to one:

Action type: Replace with regular expressions  
Field: **\_ALL**  
Regular expression: **`\s{2,}`**  
Replace matches with: " " (without the quotes)

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 3:54pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/11 "2004-04-16T15:54:34Z")

</div>

### How to remove/trim leading track numbers?

Action type: Replace with regular expressions  
Regular expression: **`^\s*\d+\s*-\s*`**  
Replace matches with:

This regular expression removes the track number from `01 - Anything..` so that only `Anything...` remains.  
**`^`** matches the beginning of the string. Then any numbers of whitespaces **`\s*`** followed by numbers from 0-9.  
The **`\s*-\s*`** part removes the hyphen and any whitespace characters around it.

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 4:14pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/12 "2004-04-16T16:14:01Z")

</div>

### How to separate or split strings that are written in one word?

You have titles that have no spaces between words (written in one big word) and all words start with a capital letter, e.g., **ThisIsTheTitle** (also referred to as CamelCase). How can Mp3tag separate the individual words and insert a space before every capital letter?

Create a [new action group](https://community.mp3tag.de/t/actions/967/2), e.g., **TagsLikeThese** for the field you wish to edit (the example uses the TITLE field):

Action type: Replace with regular expression  
Field: **TITLE**  
Regular expression: **`(\l)(\u)`**  
Replace matches with: **`$1 $2`**  
**[x]** case-sensitive comparison

or  
Regular expression: **`(\w|,)(?=\u)`**  
Replace matches with: **`$1 $2`**  
**[x]** case-sensitive comparison

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [April 16, 2004, 4:24pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/13 "2004-04-16T16:24:30Z")

</div>

### How to apply upper case after an O' (like O'Hugo)?

There are irish/scottish names like O'Donnel, O'Leary etc, that all should be upper case. But you cannot use upper case in general after an ' because other words would be spelled wrongly then (That'S, Ain'T etc.).

Action type: Replace with regular expression  
Regular expression: **`O'(.{1})`**  
Replace matches with: **`O'$upper($1)`**  
**[x]** case-sensitive comparison

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [September 11, 2005, 10:13am UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/14 "2005-09-11T10:13:40Z")

</div>

### How to swap the contents of 2 tag fields?

Example how to swap TITLE and ARTIST:

Create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group or make a new action group.

Action type: Guess values  
Source format: **`%title%~%artist%`**  
Guessing pattern: **`%artist%~%title%`**

Note: The **`~`** sign is just used to separate the two fields, you could take any other sign that does not appear in your fields, e.g. **`¢`** or an extended unicode character like ∞ or ∑.

---

<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: [February 10, 2010, 12:19pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/15 "2010-02-10T12:19:50Z")

</div>

### How to copy one field value to another field?

Example how to copy the content of the ARTIST field to the ALBUMARTIST field:

Create a [new action](https://community.mp3tag.de/t/actions/967/2) in an existing action group or make a new action group.

Action type: Format value  
Field: **ALBUMARTIST**  
Format string: **`%artist%`**

Note: If you want to copy all possible values of a field (in case you have multiple artist fields), the internal scripting function [**`$meta_sep`**](https://docs.mp3tag.de/scripting) can be used in the format string, e.g., **`$meta_sep(artist,\\\\)`**

---

<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: [January 23, 2021, 6:44pm UTC](https://community.mp3tag.de/t/actions-and-batch-operations/967/16 "2021-01-23T18:44:23Z")

</div>

## Organizing Actions

### Keyboard Shortcuts

While it's not directly possible to assign arbitrary keys to action groups, you can use the keyboard shortcut to trigger the action group _menu_ Alt+A in combination with another character from the action group name. Simply decide on the character and prefix it with **`&`**. You can then use Alt+A and the character to trigger the action group.

An example action group **`&Uppercase`** can be triggered by Alt+A plus U.

### Submenus in the Action Group menu

If you use the **`#`** in your action group name, Mp3tag uses anything before the `#` as name for a submenu and anything after as a menu item in that menu. By that, you can organize action groups that belong together.

An example action group **`Default values#Set COMMENT`** would create a submenu **`Default values`** and would list the action group **`Set COMMENT`** within this menu.

> **Pro tip** : you can combine both tips, e.g., **`&Default values#Set &COMMENT`** to trigger the action group by pressing Alt+A plus D plus C.
