# How to remove track from filename?

**URL:** https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623
**Category:** Support
**Created:** [July 18, 2009, 6:48am UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623 "2009-07-18T06:48:47Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Tweak322](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/a9a28c/32.png) [@Tweak322](https://community.mp3tag.de/u/Tweak322)
#### Post date: [July 18, 2009, 6:48am UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/1 "2009-07-18T06:48:47Z")

</div>

I have a bunch of songs that begin with 01 & 02. (note the .) track numbers at the beginning of each songs filename. Is there an easy way of removing this?

Thanks

(Example songs)  
09. Pink Floyd - Have a Cigar  
11 - Donovan - Sunshine Superman (how can I remove the first hyphen but leave the second?)

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [July 18, 2009, 10:56am UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/2 "2009-07-18T10:56:44Z")

</div>

> [@Tweak322](#):
>
> ... (Example songs)  
> 09. Pink Floyd - Have a Cigar  
> 11 - Donovan - Sunshine Superman (how can I remove the first hyphen but leave the second?)

ad 1: Do you want to have the dot replaced with a space character?  
ad 2: Do you want to have the first hyphen replaced with nothing and should there remain two spaces between the track number and the artist?

DD.20090718.1456.CEST

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [July 18, 2009, 7:43pm UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/3 "2009-07-18T19:43:45Z")

</div>

Assuming the track number, artist, and title fields are correct, you could just rename the file from those fields:

_Action type:_ **Format value**  
_Field:_ **\_FILENAME**  
_Format string:_ **$num(%track%,2) $validate(%artist% - %title%,-)**

If not, a regex should work:

_Action type:_ **Format value**  
_Field:_ **\_FILENAME**  
_Format string:_ **$regexp(%\_filename%,^([0-9]+)\s\*[.-]_\s_(.\*) ,$1 $2)**

---

<div class="post-metadata">

### Author: ![Tweak322](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/a9a28c/32.png) [@Tweak322](https://community.mp3tag.de/u/Tweak322)
#### Post date: [July 19, 2009, 2:34am UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/4 "2009-07-19T02:34:55Z")

</div>

> [@DetlevD](#):
>
> ad 1: Do you want to have the dot replaced with a space character?  
> ad 2: Do you want to have the first hyphen replaced with nothing and should there remain two spaces between the track number and the artist?
> 
> DD.20090718.1456.CEST

I want the the track number, period and the first hyphen removed from the filename

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [July 19, 2009, 3:43am UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/5 "2009-07-19T03:43:53Z")

</div>

> [@Tweak322](#):
>
> I want the the track number, period and the first hyphen removed from the filename

This expression removes leading numbers, dots, hyphens and also space characters from the filename.

**$regexp(%\_FILENAME%,'\[1\]+(.\*)',$1)**

Use it with "[Alt-1] Tag-Filename" or with an action "Format value".

DD.20090719.0747.CEST

* * *

1. \d.-

---

<div class="post-metadata">

### Author: ![Tweak322](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/a9a28c/32.png) [@Tweak322](https://community.mp3tag.de/u/Tweak322)
#### Post date: [July 19, 2009, 3:56am UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/6 "2009-07-19T03:56:53Z")

</div>

> [@JJ Johnson](#):
>
> If not, a regex should work:
> 
> _Action type:_ **Format value**  
> _Field:_ **\_FILENAME**  
> _Format string:_ **$regexp(%\_filename%,^([0-9]+)\s\*[.-]_\s_(.\*) ,$1 $2)**

I tried this action script only to get this ([picture of error message](http://img20.imageshack.us/i/58803193.jpg/))

---

<div class="post-metadata">

### Author: ![Tweak322](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/a9a28c/32.png) [@Tweak322](https://community.mp3tag.de/u/Tweak322)
#### Post date: [July 19, 2009, 4:24am UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/7 "2009-07-19T04:24:12Z")

</div>

> [@DetlevD](#):
>
> This expression removes leading numbers, dots, hyphens and also space characters from the filename.
> 
> **$regexp(%\_FILENAME%,'\[1\]+(.\*)',$1)**
> 
> Use it with "[Alt-1] Tag-Filename" or with an action "Format value".
> 
> DD.20090719.0747.CEST

Thank you works perfectly

* * *

1. \d.-

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [July 19, 2009, 7:00am UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/8 "2009-07-19T07:00:10Z")

</div>

> [@Tweak322](#):
>
> I want the the track number, period and the first hyphen removed from the filename

That's easily done, but are you sure that you want the track number removed from the filename? That generally results in a folder full of files that are sorted by somthing (only track title) that isn't very useful.

---

<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:21pm UTC](https://community.mp3tag.de/t/how-to-remove-track-from-filename/8623/9 "2026-02-09T12:21:39Z")

</div>


