# Help converting Year to a simpler format

**URL:** <https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180>\
**Category:** Support\
**Created:** [March 23, 2018, 10:31am UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180 "2018-03-23T10:31:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![henriquebs12](https://community.mp3tag.de/user_avatar/community.mp3tag.de/henriquebs12/32/8205_2.png) [@henriquebs12](https://community.mp3tag.de/u/henriquebs12)\
**Post date:** [March 23, 2018, 10:31am UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/1 "2018-03-23T10:31:01Z")

</div>

I have my Year tag in the iTunes format. Eg 2014-07-31T07:00:00Z.

I want to create folders of all files in the format "Year - Album name", but when I create an action of the type Format value, I used %year% - %album%%\_FILENAME%, with \_FILENAME in field., but it generates that confusing format.

What expression should I use, to pick up only the first 4 digits, or at lease what's before "-"?

Thanks!

---

<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:** [March 23, 2018, 10:43am UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/2 "2018-03-23T10:43:51Z")

</div>

see e.g.

> [@Trim %Year% if beyond 4 characters](https://community.mp3tag.de/t/trim-year-if-beyond-4-characters/14274):
>
> I have numerous files where the year is listed as "2012-12-27". I want to trim this to only show the actual 4 digit year - "2012" for example. I have tried the following: $if($len(%Year%)\>4,$cutRight(%Year%,6),%Year%) This will trim everything after the first 4 digits for those files where the year is greater than 4 characters in length. However, when running this action, if it finds a file with only a 4 digit year, it is deleting it. So, in the end, I want to be able to check the year field…

Why do you include the filename in the folder name?

> [@henriquebs12](#):
>
> I want to create folders of all files in the format "Year - Album name", but when I create an action of the type Format value, I used %year% - %album%%\_FILENAME%,

Aren't there many files in the folder?  
The format of the year that you show is actually the format for RELEASETIME. I would copy the data from YEAR to RELEASETIME and then cut the YEAR to just 4 digits as that is the format that the standard defines.

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [March 23, 2018, 7:25pm UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/3 "2018-03-23T19:25:29Z")

</div>

> [@henriquebs12](#):
>
> I have my Year tag in the iTunes format. Eg 2014-07-31T07:00:00Z.

To get the year here you have to match 4 digits uninterrupted so to speak.

So in your format for the directory for just the year (the rest you know, although like @ohrenkino has mentioned there's no need for the filename here I'd say) :  
`$regexp(%year%,.*?(\d{4}).+?,$1)`

---

<div class="post-metadata">

**Author:** ![henriquebs12](https://community.mp3tag.de/user_avatar/community.mp3tag.de/henriquebs12/32/8205_2.png) [@henriquebs12](https://community.mp3tag.de/u/henriquebs12)\
**Post date:** [March 27, 2018, 5:45am UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/4 "2018-03-27T05:45:13Z")

</div>

I actually wrote wrong, the action I really had was: Format Value: C:..%year% - %album%%\_FILENAME%, so It kept the original filename and added each song to its album folder. Note that my songs are all in the same folder, that's why I could not just change the folder's name, because the folders don't exist.

The tag is really YEAR, and I tried  
$regexp(%year%,.\*?(\d{4}).+?,$1)  
$if($eql($len(%YEAR%),10),$cutRight(%YEAR%,6),%YEAR%)  
$left(%TAGFIELD%,4)

But none of them worked properly. What should I do?

---

<div class="post-metadata">

**Author:** ![henriquebs12](https://community.mp3tag.de/user_avatar/community.mp3tag.de/henriquebs12/32/8205_2.png) [@henriquebs12](https://community.mp3tag.de/u/henriquebs12)\
**Post date:** [March 27, 2018, 5:51am UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/5 "2018-03-27T05:51:15Z")

</div>

It did not work, it stills creating the folder in the format 2014-07-31T07:00:00Z - Album Name.

Is it in Format Value box?

I tried `_FILENAME` in the Field, and `$regexp(%year%,.*?(\d{4}).+?,$1)` in the sequences value.

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [March 27, 2018, 6:13am UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/6 "2018-03-27T06:13:52Z")

</div>

> [@henriquebs12](#):
>
> $left(%TAGFIELD%,4)

`$left(%year%,4)`

so it would look like  
`%_folderpath%\$left(%year%,4) - %album%\%_filename%`  
if you want to create the folders in the the same folder where your files are now.  
If you want to create the folders elsewhere you have to use an absolute path for the new location.

As an alternative way you can use the converter Tag-\>Filename with the same format-string. There you have a preview which is very comfortable when you are testing format-strings.

If your year-tag is not always present you can take  
`%_folderpath%\[$left(%year%,4) -]%album%\%_filename%`  
In this case the content in the square-brackets is neglected.

---

<div class="post-metadata">

**Author:** ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)\
**Post date:** [March 27, 2018, 9:38am UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/7 "2018-03-27T09:38:01Z")

</div>

> [@stevehero](#):
>
> $regexp(%year%,.\*?(\d{4}).+?,$1)

Sorry, I didn't test.  
`$regexp(%year%,^.*(\d{4}).+?$,$1)`

---

<div class="post-metadata">

**Author:** ![henriquebs12](https://community.mp3tag.de/user_avatar/community.mp3tag.de/henriquebs12/32/8205_2.png) [@henriquebs12](https://community.mp3tag.de/u/henriquebs12)\
**Post date:** [March 27, 2018, 5:09pm UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/8 "2018-03-27T17:09:21Z")

</div>

Thank you. You're a genius.

---

<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:27pm UTC](https://community.mp3tag.de/t/help-converting-year-to-a-simpler-format/41180/9 "2026-02-09T12:27:19Z")

</div>


