# Import my cover front, regardless of the extension of the file in my code

**URL:** <https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670>\
**Category:** Support\
**Created:** [March 7, 2015, 4:31pm UTC](https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670 "2015-03-07T16:31:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)\
**Post date:** [March 7, 2015, 4:31pm UTC](https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670/1 "2015-03-07T16:31:44Z")

</div>

Hello, I would like to import my front cover under this code if, regardless of the extension of the file in my code:

%artist% ~ %album% (Front ~ Cover)

Instead of writing each time for each differente extention

%artist% ~ %album% (Front ~ Cover).jpg  
%artist% ~ %album% (Front ~ Cover).png

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:** [March 7, 2015, 4:49pm UTC](https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670/2 "2015-03-07T16:49:47Z")

</div>

Have you tried  
%artist% ~ %album% (Front ~ Cover).\* ?

I am not sure if it is necessary to point at a supported picture type file ...

---

<div class="post-metadata">

**Author:** ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)\
**Post date:** [March 7, 2015, 9:26pm UTC](https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670/3 "2015-03-07T21:26:07Z")

</div>

Ok, it works well. Thank you. I wanted to remove all invalid cractères with code but it is not working. I try it with the name of my files, but not with the covers:

For my filenames:

$validate($num(%track%,2) ~ %title% ~ %artist%$if($eql(%artist%,%albumartist%),,$regexp(%albumartist%,^(.+)$, ~ $1))$regexp(%album%,^(.+)$, ~ $1) ~ %year% ~ %genre%,)

For my covers:

$validate(%artist%[~ %album%] (Front ~ Cover).\*,)

Why does not it work?

---

<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 8, 2015, 7:49am UTC](https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670/4 "2015-03-08T07:49:15Z")

</div>

I think because you included the \* - as this is no valid character for a filename, you end up without the wildcard.  
Try  
$validate(%artist%[~ %album%] (Front ~ Cover),).\*

---

<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:** [March 8, 2015, 8:25am UTC](https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670/5 "2015-03-08T08:25:16Z")

</div>

> [@Sylvain.dmde](#):
>
> For my covers:  
> $validate(%artist%[~ %album%] (Front ~ Cover).\*,)  
> Why does not it work?

If you want to open an image file, then you should know the actual name of the file exactly ...  
or give Mp3tag the chance to find a possible file by using wildcard matching for the file name.

If you are guessing an existing filename in advance, then you always have two chances, either it works or it does not.  
Note: An existing file has already a validated file name!

The function $validate is good for _creating_ a valid file name.  
The function $validate is not suited to guess the name of a file, which already exists.

**Instead of ... $validate(%ARTIST%[' ~ '%ALBUM%]' (Front ~ Cover).\*',)** 

(Note: $validate removes the invalid character '\*', ...  
therefore the new filename will be unusable, because filename extension fails.)

 try this ... %ARTIST%'\*(Front ~ Cover).\*'

> [@Sylvain.dmde](#):
>
> For my filenames:  
> $validate($num(%track%,2) ~ %title% ~ %artist%$if($eql(%artist%,%albumartist%),,$regexp(%albumartist%,^(.+)$, ~ $1))$regexp(%album%,^(.+)$, ~ $1) ~ %year% ~ %genre%,)

The quoted formatstring has code, which is superfluous.

This formatstring should give the same result ...

**$validate($num(%TRACK%,2)' ~ '%TITLE%' ~ '%ARTIST%$if($eql(%ARTIST%,%ALBUMARTIST%),,' ~ '%ALBUMARTIST%' ~ '%ALBUM%)' ~ '%YEAR%' ~ '%GENRE%,)**

DD.20150308.1241.CET

---

<div class="post-metadata">

**Author:** ![sylvain.dmde](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/c57346/32.png) [@sylvain.dmde](https://community.mp3tag.de/u/sylvain.dmde)\
**Post date:** [March 8, 2015, 6:49pm UTC](https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670/6 "2015-03-08T18:49:28Z")

</div>

Thank you. I understand better and better the functioning of the programe.

---

<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:25pm UTC](https://community.mp3tag.de/t/import-my-cover-front-regardless-of-the-extension-of-the-file-in-my-code/16670/7 "2026-02-09T12:25:34Z")

</div>

Closed on February 9, 2026, 12:25pm UTC


