# Fill YEAR from first 4 characters of the folder

**URL:** <https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057>\
**Category:** Support\
**Created:** [July 31, 2019, 10:41am UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057 "2019-07-31T10:41:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElimGarak](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a183cd/32.png) [@ElimGarak](https://community.mp3tag.de/u/ElimGarak)\
**Post date:** [July 31, 2019, 10:41am UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/1 "2019-07-31T10:41:51Z")

</div>

Hello!  
I'd need an action to fill the YEAR field from the folder containing the file. The format of the folder is like the following, so I'd need to copy the four first characters:  
2019 Dummy folder

I've tried adapting a similar action I use to fill ALBUM from the same kind of folders (and it worked, deleting the first 4 numbers plus the following space), but it doesn't seem to work when I try it with YEAR. Allo I got was having the field filled with word "YEAR" or the name of the folder with the first 4 chars replaced by "dddd". 🙂

Thank you!

---

<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:** [July 31, 2019, 10:51am UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/2 "2019-07-31T10:51:02Z")

</div>

You can try  
Convert\>Filename-Tag  
Format string: %year% %dummy%

---

<div class="post-metadata">

**Author:** ![ElimGarak](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a183cd/32.png) [@ElimGarak](https://community.mp3tag.de/u/ElimGarak)\
**Post date:** [July 31, 2019, 11:21am UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/3 "2019-07-31T11:21:14Z")

</div>

Hi ohrenkino,

First of all, thank you for the answer.  
I've tried, but I get the number track.

My folder structure is as following:

ARTIST  
|\_\_\_\_\_\_\_ YYYY NAME OF ALBUM  
----------------------------|\_\_\_\_\_\_ NN TRACK TITLE  
----------------------------|\_\_\_\_\_\_ NN TRACK TITLE  
----------------------------|\_\_\_\_\_\_ NN TRACK TITLE  
----------------------------|\_\_\_\_\_\_ NN TRACK TITLE

By the way, sometimes I have this structure instead for multicd albums:

ARTIST  
|\_\_\_\_\_\_\_ YYYY NAME OF ALBUM  
----------------------------|\_\_\_\_\_\_ **CD N**  
---------------------------------------------|\_\_\_\_\_\_ NN TRACK TITLE  
---------------------------------------------|\_\_\_\_\_\_ NN TRACK TITLE  
---------------------------------------------|\_\_\_\_\_\_ NN TRACK TITLE  
----------------------------|\_\_\_\_\_\_ **CD N**  
---------------------------------------------|\_\_\_\_\_\_ NN TRACK TITLE  
---------------------------------------------|\_\_\_\_\_\_ NN TRACK TITLE  
---------------------------------------------|\_\_\_\_\_\_ NN TRACK TITLE

But I guess in this case all I have to do is replace the variable directory with parentdirectory.

Thanks again!

---

<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:** [July 31, 2019, 11:22am UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/4 "2019-07-31T11:22:56Z")

</div>

Try  
Convert\>Filename-Tag  
Format string: `%year% %dummy%\%dummy%`  
and for those with cd folders:  
Format string: `%year% %dummy%\%dummy%\%dummy%`

---

<div class="post-metadata">

**Author:** ![ElimGarak](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a183cd/32.png) [@ElimGarak](https://community.mp3tag.de/u/ElimGarak)\
**Post date:** [July 31, 2019, 11:27am UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/5 "2019-07-31T11:27:41Z")

</div>

Great! That worked, thanks!

Now if only there would be a way to memorize this so I don't have to write it everytime... This is why I asked for an action. But maybe there's a way and I just don't know it? Or do you know how to make this an action?

Thanks again!

---

<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:** [July 31, 2019, 12:06pm UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/6 "2019-07-31T12:06:46Z")

</div>

Action Type: Format Value  
Field: YEAR  
Format String: `$left(%_directory%,4)`

---

<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:** [July 31, 2019, 12:17pm UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/7 "2019-07-31T12:17:49Z")

</div>

> [@ElimGarak](#):
>
> This is why I asked for an action

The function Convert\>Filename - Tag can also expressed as an action of the type "Guess value"  
Source: %\_filename%  
Pattern: `%year% %dummy%\%dummy%`  
or  
Pattern: `%year% %dummy%\%dummy%\%dummy%`

---

<div class="post-metadata">

**Author:** ![ElimGarak](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a183cd/32.png) [@ElimGarak](https://community.mp3tag.de/u/ElimGarak)\
**Post date:** [July 31, 2019, 12:20pm UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/8 "2019-07-31T12:20:22Z")

</div>

Thank you both.  
I've used the solution posted by poster (no pun intended) and it worked. I only had to change the field from TRACK to YEAR. 😉

Have a great day!

---

<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:28pm UTC](https://community.mp3tag.de/t/fill-year-from-first-4-characters-of-the-folder/46057/9 "2026-02-09T12:28:12Z")

</div>


