# Triming last 3 chars of a filename

**URL:** <https://community.mp3tag.de/t/triming-last-3-chars-of-a-filename/15772>\
**Category:** Support\
**Created:** [May 31, 2014, 5:17am UTC](https://community.mp3tag.de/t/triming-last-3-chars-of-a-filename/15772 "2014-05-31T05:17:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbenyakar](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@dbenyakar](https://community.mp3tag.de/u/dbenyakar)\
**Post date:** [May 31, 2014, 5:17am UTC](https://community.mp3tag.de/t/triming-last-3-chars-of-a-filename/15772/1 "2014-05-31T05:17:52Z")

</div>

Hi  
I've searched a solution for my problem but could not find any.  
I have a large number of mp3 files were the filename has the track number added to them, some at the beginning of the filename and some at the end.

Im trying to use the Filename-\>Tag function to copy the filename so it is the title tag of the song but without the track number.

for example, I have filenames: 01 Cry.mp3, or Cry 01.mp3.

So my question is how can I do a batch removal of the 01 and same the title to be Cry?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [May 31, 2014, 6:51am UTC](https://community.mp3tag.de/t/triming-last-3-chars-of-a-filename/15772/2 "2014-05-31T06:51:10Z")

</div>

As the pattern is different in your filenames you have to do it in two runs - one for the files with the track number in front and for those at the end.

The mask for track number at the front:  
%track% %title%

The other one is more tricky as it is not clear how many words are in front of the number.  
So, what I would do:  
Put the whole filename into TITLE with the Convert\>Filename-Tag function.  
Then run a "Replace with regular expression" action for TITLE to remove the number  
Search string: (.\*) \d+$  
Replace string: $1  
Then use the Convert\>Tag-Filename function to rename the file, if you like.

---

<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:** [May 31, 2014, 7:05am UTC](https://community.mp3tag.de/t/triming-last-3-chars-of-a-filename/15772/3 "2014-05-31T07:05:48Z")

</div>

> [@dbenyakar](#):
>
> ... I have a large number of mp3 files were the filename has the track number added to them, some at the beginning of the filename and some at the end. ... copy the filename so it is the title tag of the song but without the track number.  
> for example, I have filenames: 01 Cry.mp3, or Cry 01.mp3. So my question is how can I do a batch removal of the 01 and same the title to be Cry?

1. Copy all the filenames to the tag-field TITLE.

**Convert "Filename - Tag"**

**Formatstring: %TITLE%**  
... or ...

 **Action "Format value" or Convert "Tag - Tag"**

**Field: TITLE  
Formatstring: %\_FILENAME%**

 
1. Set Filter [F3] to display only files for the first case (cut left).

 **Filter: TITLE MATCHES "^\d\d\s.\*$"** 
1. Change the content in the tag-field TITLE.

 **Action "Format value" or Convert "Tag - Tag"**

**Field: TITLE  
Formatstring: $cutLeft(%TITLE%,3)**

 
1. Set filter [F3] to display only files for the second case (cut right).

 **Filter: TITLE MATCHES "^.\*\s\d\d$"** 
1. Change the content in the tag-field TITLE.

 **Action "Format value" or Convert "Tag - Tag"**

**Field: TITLE  
Formatstring: $cutRight(%TITLE%,3)**

 

DD.20140531.1120.CEST

---

<div class="post-metadata">

**Author:** ![dbenyakar](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@dbenyakar](https://community.mp3tag.de/u/dbenyakar)\
**Post date:** [May 31, 2014, 11:42am UTC](https://community.mp3tag.de/t/triming-last-3-chars-of-a-filename/15772/4 "2014-05-31T11:42:44Z")

</div>

> [@DetlevD](#):
>
> 1. Change the content in the tag-field TITLE.
> 
> **Action "Format value" or Convert "Tag - Tag"**
> 
> **Field: TITLE  
> Formatstring: $cutLeft(%TITLE%,3)**
> 
>  
> 1. Change the content in the tag-field TITLE.
> 
> **Action "Format value" or Convert "Tag - Tag"**
> 
> **Field: TITLE  
> Formatstring: $cutRight(%TITLE%,3)**

I tried these but the cutLeft/cutRight only cuts the chars and not the digits.

---

<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:** [May 31, 2014, 2:28pm UTC](https://community.mp3tag.de/t/triming-last-3-chars-of-a-filename/15772/5 "2014-05-31T14:28:53Z")

</div>

> [@dbenyakar](#):
>
> I tried these but the cutLeft/cutRight only cuts the chars and not the digits.

This status indicates that something in your environment is not so given as you have it described.  
Try again.

Use these filenames for testing ...  
01 Cry.mp3  
02 Cry more.mp3  
03 Cry ever.mp3  
Cry never 06.mp3  
Cry once 04.mp3  
Cry once more 05.mp3

... and you will get the result in the tag-field TITLE ...  
Cry  
Cry more  
Cry ever  
Cry never  
Cry once  
Cry once more

Be aware of the fact, that the functions $cutLeft and $cutRight will do their work on every run.  
After a second run you will get the result in the tag-field TITLE ...  
  
more  
ever  
Cry ne  
Cry o  
Cry once m

DD.20140531.1828.CEST, DD.20140531.2056.CEST

---

<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:25pm UTC](https://community.mp3tag.de/t/triming-last-3-chars-of-a-filename/15772/6 "2026-02-09T12:25:04Z")

</div>

Closed on February 9, 2026, 12:25pm UTC


