# Help for Automagic Do-All Action

**URL:** https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143
**Category:** Support
**Created:** [April 4, 2006, 11:35pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143 "2006-04-04T23:35:06Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Ruse](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/a587f6/32.png) [@Ruse](https://community.mp3tag.de/u/Ruse)
#### Post date: [April 4, 2006, 11:35pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/1 "2006-04-04T23:35:06Z")

</div>

I am looking for an action that will remove from filenames any character(s) other than dash, underscore, letters and numbers. Does anyone have an example or a solution to this besides creating a replace action for each character that is to be omitted?

My goal is to have one action that (after tagging all mp3's correctly) will remove all unsupported characters from the filename, then put the filename in the format of artist-album-track-title.extension in lowercase and with underscores instead of spaces. So far, I've all the actions for this except one to remove unsupported characters.

Any help would be greatly appreciated.

BTW, this is such a marvelous application.

---

<div class="post-metadata">

### Author: ![Sebastian\_Mares](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sebastian_mares/32/9285_2.png) [@Sebastian\_Mares](https://community.mp3tag.de/u/Sebastian_Mares)
#### Post date: [April 5, 2006, 3:16am UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/2 "2006-04-05T03:16:36Z")

</div>

Why do you need to clean the filename first when you are generating it a moment later based on the tag information?

Anyways, I have to jet to school right now, but have a look at these functions in [https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting) :

$replace()  
$validate()  
$lower()

---

<div class="post-metadata">

### Author: ![Ruse](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/a587f6/32.png) [@Ruse](https://community.mp3tag.de/u/Ruse)
#### Post date: [April 5, 2006, 6:54pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/3 "2006-04-05T18:54:36Z")

</div>

> [@](#):
>
> Why do you need to clean the filename first when you are generating it a moment later based on the tag information?
> 
> Anyways, I have to jet to school right now, but have a look at these functions in [https://docs.mp3tag.de/scripting](https://docs.mp3tag.de/scripting) :
> 
> $replace()  
> $validate()  
> $lower()
> 
> \<{POST\_SNAPBACK}\>

I'm actually cleaning the filename _after_ it is generated from the tags. As far as I know, the validate function only removes these characters: /?\*"\<\>|.

I'm trying to make something that will keep a character if it is a letter, number, underscore or dash. If it is not, it will remove it.

---

<div class="post-metadata">

### Author: ![Sebastian\_Mares](https://community.mp3tag.de/user_avatar/community.mp3tag.de/sebastian_mares/32/9285_2.png) [@Sebastian\_Mares](https://community.mp3tag.de/u/Sebastian_Mares)
#### Post date: [April 5, 2006, 7:10pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/4 "2006-04-05T19:10:56Z")

</div>

> [@](#):
>
> I'm actually cleaning the filename _after_ it is generated it from the tags. As far as I know, the validate function only removes these characters: /?\*"\<\>|.
> 
> I'm trying to make something that will keep a character if it is a letter, number, underscore or dash. If it is not, it will remove it.
> 
> \<{POST\_SNAPBACK}\>

Hmm... Well, it can be done with RegEx (dano knows more about RegEx than me), but are you sure you want that? It would also change "That's\_it" into "Thats\_it".

---

<div class="post-metadata">

### Author: ![Ruse](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/a587f6/32.png) [@Ruse](https://community.mp3tag.de/u/Ruse)
#### Post date: [April 5, 2006, 7:39pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/5 "2006-04-05T19:39:03Z")

</div>

> [@](#):
>
> Hmm... Well, it can be done with RegEx (dano knows more about RegEx than me), but are you sure you want that? It would also change "That's\_it" into "Thats\_it".
> 
> \<{POST\_SNAPBACK}\>

That's what I'm trying to do.

Based on these parts of the help file on scripting,

- $if(x,y,z) if x is true, y is returned, otherwise z.
- "\w" Any word character - all alphanumeric characters plus the underscore.
- The dot character "." matches any single character.

I'm trying to do something like this:

Format Value:  
Field: \_FILENAME  
Format String: $if(character= (\w or -), leave alone, delete)

but can't achieve the proper syntax.

---

<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 5, 2006, 8:13pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/6 "2006-04-05T20:13:19Z")

</div>

You cannot mix the different action types.  
Things like \w are only available at Replace with regular expressions

You can make an action Replace with regular expressions, but it will also remove the dot before the file extension, you will need a 2nd action to put it back:

Action #1:  
_Action type:_ **Replace with regular expressions**  
_Field:_ **\_FILENAME**  
_Regular expression:_ **[^-\w]**  
_Replace matches with:_

[] case-sensitive comparison

Action #2:  
_Action type:_ **Replace with regular expressions**  
_Field:_ **\_FILENAME**  
_Regular expression:_ **(mp3)$**  
_Replace matches with:_ **.$1**

[] case-sensitive comparison

---

<div class="post-metadata">

### Author: ![Ruse](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/a587f6/32.png) [@Ruse](https://community.mp3tag.de/u/Ruse)
#### Post date: [April 5, 2006, 8:44pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/7 "2006-04-05T20:44:46Z")

</div>

Thanks Dano that worked great. This is my action now:

Action #1:  
_Action type:_ **Format value**  
_Field:_ **\_FILENAME**  
_Formatstring:_ **%artist%-%album%-$num(%track%,2)-%title%**

Action #2:  
_Action type:_ **Case conversion**  
_Field:_ **\_FILENAME**  
_Case conversion:_ **lower case**  
_Words begin from/after any of:_

Action #3:  
_Action type:_ **Remove fields**  
_Fields to remove (semicolon-separated):_ **Comment**

Action #4:  
_Action type:_ **Replace with regular expression**  
_Field:_ **\_ALL**  
_Regular expression:_ **^\s+**  
_Replace matches with:_

[] case-sensitive comparison

Action #5:  
_Action type:_ **Replace with regular expression**  
_Field:_ **\_ALL**  
_Regular expression:_ **\s+$**  
_Replace matches with:_

[] case-sensitive comparison

Action #6:  
_Action type:_ **Replace with regular expression**  
_Field:_ **\_FILENAME**  
_Regular expression:_ **\s+.(mp3|m4a|flac|ogg|mpc|wma)$**  
_Replace matches with:_ **.$1**

[] case-sensitive comparison

Action #7:  
_Action type:_ **Replace with regular expression**  
_Field:_ **\_ALL**  
_Regular expression:_ **\s{2,}**  
_Replace matches with:_

[] case-sensitive comparison

Action #8:  
_Action type:_ **Replace with regular expression**  
_Field:_ **_FILENAME_**  
_Regular expression:_ **\s**  
_Replace matches with:_

[] case-sensitive comparison

Action #9:  
_Action type:_ **Replace with regular expression**  
_Field:_ **\_FILENAME**  
_Regular expression:_ **[^-\w]**  
_Replace matches with:_

[] case-sensitive comparison

Action #10:  
_Action type:_ **Replace with regular expression**  
_Field:_ **\_FILENAME**  
_Regular expression:_ **(mp3|m4a|flac|ogg|mpc|wma)$**  
_Replace matches with:_ **.$1**

[] case-sensitive comparison

Does everything look clean? I'm trying to avoid redundancy and going about things the wrong way.

**Moderation:** Formatted raw action file that was posted.

---

<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 5, 2006, 9:26pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/8 "2006-04-05T21:26:59Z")

</div>

I think it's ok. But you could change the first one to  
$lower(%artist%-%album%-$num(%track%,2)-%title%)  
and remove the second.

---

<div class="post-metadata">

### Author: ![Ruse](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/a587f6/32.png) [@Ruse](https://community.mp3tag.de/u/Ruse)
#### Post date: [April 5, 2006, 10:37pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/9 "2006-04-05T22:37:27Z")

</div>

> [@](#):
>
> I think it's ok. But you could change the first one to  
> $lower(%artist%-%album%-$num(%track%,2)-%title%)  
> and remove the second.
> 
> \<{POST\_SNAPBACK}\>

Awesome. Thanks a bunch dano and Sebastian Mares.

---

<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:19pm UTC](https://community.mp3tag.de/t/help-for-automagic-do-all-action/3143/10 "2026-02-09T12:19:42Z")

</div>


