# Get year from file name

**URL:** https://community.mp3tag.de/t/get-year-from-file-name/10338
**Category:** Support
**Created:** [April 24, 2010, 7:29am UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338 "2010-04-24T07:29:53Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Stefanovic](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@Stefanovic](https://community.mp3tag.de/u/Stefanovic)
#### Post date: [April 24, 2010, 7:29am UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/1 "2010-04-24T07:29:53Z")

</div>

Hi,

I´ve got a whole bunch of house livesets, all named **artist @ title dd-mm-year.mp3** , for example **Armin van Buuren @ A State of Trance 322 01-04-2009.**

How do I convert the year to the year-tag? I've got artist and title, but I can't find a way to tell Mp3tag to use the four digits before _.mp3_ as the year tag.

Steven

---

<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: [April 24, 2010, 7:40am UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/2 "2010-04-24T07:40:21Z")

</div>

> [@Stefanovic](#):
>
> example **Armin van Buuren @ A State of Trance 322 01-04-2009.**

there are several ways.  
first suggestion:  
Use an action of the type format tag field with regular expression for YEAR and put as format string $right(%\_filename%,4)  
which takes the rightmost 4 characters and inserts then into year.

Or (second suggestion):  
use "Filename - TAG" with a mask like  
%dummy%-%year%  
which wll put the year into YEAR and also create a tag dummy but that can be deleted afterwards.  
The preview should show whether you reach your goal.

---

<div class="post-metadata">

### Author: ![Stefanovic](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@Stefanovic](https://community.mp3tag.de/u/Stefanovic)
#### Post date: [April 24, 2010, 8:43pm UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/3 "2010-04-24T20:43:31Z")

</div>

thanks, second one works!

---

<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: [April 25, 2010, 10:14am UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/4 "2010-04-25T10:14:19Z")

</div>

> [@Stefanovic](#):
>
> thanks, second one works!

Hmm, as I understand correctly what has been written above ...

ohrenkino's first suggestion is the simplest way to extract the rightmost four characters from the given filename sting (... but there is no need of handling a regular expression).  
Action: Format value  
Tagfield: YEAR  
Value: right(%\_FILENAME%,4)

> [@](#):
>
> I've got artist and title, but I can't find a way to tell Mp3tag to use the four digits before .mp3 as the year tag.

Now I am curious how you got artist and title from the filename string.

DD.20100425.1414.CEST

---

<div class="post-metadata">

### Author: ![Stefanovic](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@Stefanovic](https://community.mp3tag.de/u/Stefanovic)
#### Post date: [April 25, 2010, 5:45pm UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/5 "2010-04-25T17:45:50Z")

</div>

> [@DetlevD](#):
>
> Now I am curious how you got artist and title from the filename string.
> 
> DD.20100425.1414.CEST

simply: artist @ title 🙂

---

<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: [April 26, 2010, 5:03pm UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/6 "2010-04-26T17:03:47Z")

</div>

> [@Stefanovic](#):
>
> simply: artist @ title 🙂

Well it looks like, if you use this "artist @ title" as a format string, but it is not a well formed one.  
And what action should I use together with this Format string?  
To split ...  
Armin van Buuren @ A State of Trance 322 01-04-2009.  
Into separated tag fields Artist and Ttitle ...  
Using format string ...  
%artist% @ %title%

DD.20100426.2103.CEST  
Edit.  
DD.20100504.1545.CEST

---

<div class="post-metadata">

### Author: ![Stefanovic](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@Stefanovic](https://community.mp3tag.de/u/Stefanovic)
#### Post date: [April 26, 2010, 6:42pm UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/7 "2010-04-26T18:42:50Z")

</div>

the filename-to-tag function.. Or don't I understand your question? 😉

---

<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: [April 27, 2010, 4:04pm UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/8 "2010-04-27T16:04:59Z")

</div>

> [@Stefanovic](#):
>
> the filename-to-tag function. ...

Sorry Stefanovic ...

using the given filename:  
Armin van Buuren @ A State of Trance 322 01-04-2009.

and using Convert/Filename to Tag with Format string:  
artist @ title

... there is no way to fill any tag field.

Please give a short description what I have to do to get ...  
ARTIST=Armin van Buuren  
TITLE=A State of Trance 322  
... ???

Thanks in advance.

DD.20100427.2004.CEST

---

<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 3, 2010, 4:07pm UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/9 "2010-05-03T16:07:09Z")

</div>

Hi Stefanovic, is there any chance to get a helpful description from you how to solve this task?

How to split the filename into three parts and set tag fields accordingly?

Given filename:  
Armin van Buuren @ A State of Trance 322 01-04-2009

Goal:  
ARTIST=Armin van Buuren  
TITLE=A State of Trance 322  
YEAR=2009-04-01

DD.20100503.2005.CEST

---

<div class="post-metadata">

### Author: ![Stefanovic](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@Stefanovic](https://community.mp3tag.de/u/Stefanovic)
#### Post date: [May 3, 2010, 4:36pm UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/10 "2010-05-03T16:36:54Z")

</div>

first do filename to tag: **artist @ title**   
This will make the tags:  
artist = Armin van Buuren  
and title = A State of Trance 322 01-04-2009

Then do **%dummy%-%dummy%-%year%** to get year = 2009.

I don't know how to do the entire date as a year.

---

<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 4, 2010, 10:29am UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/11 "2010-05-04T10:29:47Z")

</div>

Never mind, the Convert Dialogues could not help to solve the task in a straight manner.  
But I have found a way to split the filename into three parts and to fill the related tag fields by using a $regexp() function, which prepares the filename string for easy splitting afterwards by the action "Guess values" (in german "Aktion Tag-Felder importieren").

From Filename:  
**Armin van Buuren @ A State of Trance 322 18-10-2007**  
To Tag Fields:  
ARTIST= **Armin van Buuren**  
TITLE= **A State of Trance 322**  
YEAR= **2007-10-18**

_Actiontype 7:_ **Import tag fields (guess values)**  
_Source format:_ **$regexp(%\_FILENAME%,'^(.+?)÷@÷(.+?)÷(\d\d)-(\d\d)-(\d\d\d\d)$','$1|$2|$5-$4-$3')**  
_Guessing pattern:_ **%ARTIST%|%TITLE%|%YEAR%**  
_Note: Replace each special ÷ character with one space character._

DD.20100504.1429.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:22pm UTC](https://community.mp3tag.de/t/get-year-from-file-name/10338/12 "2026-02-09T12:22:20Z")

</div>


