# How can I extract Year from filename?

**URL:** https://community.mp3tag.de/t/how-can-i-extract-year-from-filename/12046
**Category:** General Discussion
**Created:** [May 25, 2011, 3:33am UTC](https://community.mp3tag.de/t/how-can-i-extract-year-from-filename/12046 "2011-05-25T03:33:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![StarGehzer](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a5b964/32.png) [@StarGehzer](https://community.mp3tag.de/u/StarGehzer)
#### Post date: [May 25, 2011, 3:33am UTC](https://community.mp3tag.de/t/how-can-i-extract-year-from-filename/12046/1 "2011-05-25T03:33:22Z")

</div>

I have hundreds of files named like: "A Girl Like You - Edwyn Collins 1995.mp3".  
I'd like to take the year, 1995 in this case, and have it saved in the Year space in the tag.

I've spent 2 hours trying to figure it out and searching the site.  
I thought I might be able to put a seperator (a dash, - ) between the artist & the year, then I could go from there, but couldn't figure that out..  
I could get the word 'Collins' into the year tag, but that's no good. lol

could someone please help me out with this.

Thanks.

---

<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: [May 25, 2011, 3:59am UTC](https://community.mp3tag.de/t/how-can-i-extract-year-from-filename/12046/2 "2011-05-25T03:59:22Z")

</div>

Try using an action:

_Action type:_ **Format value**  
_Field:_ **YEAR**  
_Format string:_ **$right(%\_filename%,4)**

Test it out on a few files first.
