Delete digits from filename

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?

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.

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.

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

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

Please show us a screenshot. Maybe we can rebuild your filename from Tags as @MotleyG already suggested.

All I have.

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

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

1 Like

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)

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}$

1 Like

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.

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

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!!

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.

1 Like

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