Fill YEAR from first 4 characters of the folder

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". :slight_smile:

Thank you!

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

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!

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

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!

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

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%

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. :wink:

Have a great day!