# Delete digits from filename

**URL:** https://community.mp3tag.de/t/delete-digits-from-filename/62620
**Category:** Support
**Created:** [October 31, 2023, 1:02pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620 "2023-10-31T13:02:27Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![JoaoBC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@JoaoBC](https://community.mp3tag.de/u/JoaoBC)
#### Post date: [October 31, 2023, 1:02pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/1 "2023-10-31T13:02:27Z")

</div>

Hello  
The example above shows how to extract the date from the FILENAME field.  
How do I delete these digits/numbers from the FILENAME field?

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [October 31, 2023, 1:29pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/2 "2023-10-31T13:29:54Z")

</div>

Please show us a real current filename (including the digits or date) and how you would like to see it.  
Regular expressions are extremely tricky and mostly work for one specific source pattern and can not "just used" for other purposes.

---

<div class="post-metadata">

### Author: ![MotleyG](https://community.mp3tag.de/user_avatar/community.mp3tag.de/motleyg/32/440_2.png) [@MotleyG](https://community.mp3tag.de/u/MotleyG)
#### Post date: [October 31, 2023, 1:39pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/3 "2023-10-31T13:39:09Z")

</div>

If you already have your music tagged with Title, Track, Disc, Album, AlbumArtist, etc., why not build a consistent naming pattern from those? This avoids the idea of trying to strip out parts of a filename that may also have other problems and instead ensures you have a naming template for all files moving forward. You could include directory structure as well this way.

---

<div class="post-metadata">

### Author: ![JoaoBC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@JoaoBC](https://community.mp3tag.de/u/JoaoBC)
#### Post date: [October 31, 2023, 5:34pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/4 "2023-10-31T17:34:23Z")

</div>

Many times, you receive/purchase/download music with strange name.  
Example:  
Beatles concert recorded in 1968.03.03.mp3  
==\>\>  
Battles concert recorded in.mp3

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [October 31, 2023, 5:36pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/5 "2023-10-31T17:36:43Z")

</div>

What do you see as content in your Extended Tags (Alt+ T) for this song?

Please show us a [screenshot](https://community.mp3tag.de/t/hints-for-asking-support-requests/56190#use-screenshots-to-exemplify-the-issue-2). Maybe we can rebuild your filename from Tags as @MotleyG already suggested.

---

<div class="post-metadata">

### Author: ![JoaoBC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@JoaoBC](https://community.mp3tag.de/u/JoaoBC)
#### Post date: [October 31, 2023, 5:46pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/6 "2023-10-31T17:46:15Z")

</div>

All I have.

 ![Captura de Tela (6)](https://community.mp3tag.de/uploads/default/original/2X/5/5259788fef1b7b30be579a117a0237df7f091dad.png)

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [October 31, 2023, 5:50pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/7 "2023-10-31T17:50:55Z")

</div>

Your filename in the above example is:  
`Show dos Beatles - Gravado em 1968.03.03.mp3`  
your Tag TITLE contains:  
`Show dos Beatles Gravado em 1968.03.03`

If you really only want to adjust the filename (and create a difference between the filename and your TITLE content) then you could use an Action

Type: Format Value  
Field: \_FILENAME  
Formatstring:  
`$regexp(%_filename%,(.*) \d{4}\.\d{2}\.\d{2}$,$1)`

![image](https://community.mp3tag.de/uploads/default/original/2X/8/87335826d2ac78e8e2b17310408dbcf9cd7b8e0d.png)

This would transform your  
`Beatles concert recorded in 1968.03.03.mp3`  
into  
`Beatles concert recorded in.mp3`  
or for your above example:  
`Show dos Beatles - Gravado em.mp3`

**BUT:**  
Do you really want a filename that ends with "recorded in" or " Gravado em" without anything following?

And this regular expression only works if your filename exactly ends with a date in this form:  
`1234.12.12`

---

<div class="post-metadata">

### Author: ![JoaoBC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@JoaoBC](https://community.mp3tag.de/u/JoaoBC)
#### Post date: [October 31, 2023, 6:16pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/8 "2023-10-31T18:16:28Z")

</div>

Thanks for the quick response.  
In fact, it was an "error" of mine in translation, and in transporting it to mp3tag, to be able to post it here.  
The correct one was:  
Beetles Show - Liverpool, 03.03.1968.mp3 (file name)  
Only. Titles and other fields are blank. (Empty)

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [October 31, 2023, 6:20pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/9 "2023-10-31T18:20:23Z")

</div>

Here you see the basic problem with regular expressions:  
`Show dos Beatles - Gravado em 1968.03.03.mp3`  
has not the same date syntax as  
`Beetles Show - Liverpool, 03.03.1968.mp3`

There is no easy way to catch all possible  
YYYY.DD.MM  
DD.MM.YYYY  
D.M.YY  
D.M.YYYY  
and many more variations with - between the digits.  
Also the comma would be a problem.

You have to adjust the regular expression for `1968.03.03`  
`(.*) \d{4}\.\d{2}\.\d{2}$`  
according to your real existing filenames.  
For `, 03.03.1968` something like  
`(.*)',' \d{2}\.\d{2}\.\d{4}$`

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [October 31, 2023, 6:42pm UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/10 "2023-10-31T18:42:44Z")

</div>

Thank you for marking the above answer as solution.

Just for future readers:  
This regular expression removes/deletes digits from filename.  
If you don't save this date into a tag before you execute this regular expression, you loose this information irretrievable.

---

<div class="post-metadata">

### Author: ![JoaoBC](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@JoaoBC](https://community.mp3tag.de/u/JoaoBC)
#### Post date: [November 1, 2023, 10:20am UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/11 "2023-11-01T10:20:28Z")

</div>

The friend above, LyricsLover, is absolutely right.  
Many readers may be asking themselves:

- Wouldn't it be easier, when receiving/downloading/buying a song, to edit the tag to standardize it?  
Yes, and that's exactly what everyone does.  
So what is this request for?  
Used to change the default of ALL files at once.  
For example, to change the date of all accumulated files at once. In all files, the date is removed from the filename and placed in another field, for example: year, after changing the date to another field, using another action.  
[RegEx example to extract values matching 00\_00\_00 from a set of inconsistently named files](https://community.mp3tag.de/t/regex-example-to-extract-values-matching-00-00-00-from-a-set-of-inconsistently-named-files/62602)

To save the date before deleting it:

1. Select the desired record
2. Menu =\> Convert =\> Tag-Tag
3. Choose:  
Field: =\> DATE  
Format String: =\> $regexp(%\_FILENAME%,._(\d\d\d\d.\d\d.\d\d)._,$1)

* * *

Thanks LyricsLove for the tips!!

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [November 1, 2023, 10:34am UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/12 "2023-11-01T10:34:53Z")

</div>

> [@JoaoBC](#):
>
> In all files, the date is removed from the title and placed in another field, for example: year.

To be clear:  
The date will be removed from the FILENAME in the above example, not from the TITLE.

Of course you could use the same regular expression to remove a date from TITLE (or every other tag that contains a date in the expected format) if you adjust the target field.

The above regular expression does NOT place the date into another field.  
Not into YEAR, not into RELEASETIME nor somewhere else.  
You would have to create such an action by yourself before you execute this removing regular expression.

**Warning** :  
Removing informations like a date without having it saved somewhere else will result in a complete loss of this information.

---

<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: [December 1, 2023, 10:35am UTC](https://community.mp3tag.de/t/delete-digits-from-filename/62620/13 "2023-12-01T10:35:12Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
