# Help with script for exporting cover art

**URL:** <https://community.mp3tag.de/t/help-with-script-for-exporting-cover-art/45768>\
**Category:** Support\
**Created:** [June 28, 2019, 1:42pm UTC](https://community.mp3tag.de/t/help-with-script-for-exporting-cover-art/45768 "2019-06-28T13:42:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabiorfreitas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/fabiorfreitas/32/7501_2.png) [@fabiorfreitas](https://community.mp3tag.de/u/fabiorfreitas)\
**Post date:** [June 28, 2019, 1:42pm UTC](https://community.mp3tag.de/t/help-with-script-for-exporting-cover-art/45768/1 "2019-06-28T13:42:57Z")

</div>

Basically, I want my album folders (my library goes album artist\>album) to have the cover art in the following way: - .jpg. Thats's because I've chosen to have multi-disc albums with separate covers as one single album, so I need to append the discnumber to differentiate them.

The problem is: some of my discnumbers are a single digit, others are \*/1, \*/4, \*\*/10, etc, so I need to trim the '/' and whatever comes after it. I've tryed the following expression and some alternatives, but didn't get it to work:

%path%/%album% - $trimRight(%discnumber%,(/.))

Any ideas?  
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:** [June 28, 2019, 1:49pm UTC](https://community.mp3tag.de/t/help-with-script-for-exporting-cover-art/45768/2 "2019-06-28T13:49:52Z")

</div>

> [@fabiorfreitas](#):
>
> %path%/%album% - $trimRight(%discnumber%,(/.))

I think, it should be %\_path% ... but if you want to save the cover in the current folder anyway, you can leave that out.  
So it would  
`%album% - $num(%discnumber%,1)`  
of if the %discnumber is not always filled  
`%album%[- $num(%discnumber%,1)]`

---

<div class="post-metadata">

**Author:** ![fabiorfreitas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/fabiorfreitas/32/7501_2.png) [@fabiorfreitas](https://community.mp3tag.de/u/fabiorfreitas)\
**Post date:** [June 28, 2019, 2:32pm UTC](https://community.mp3tag.de/t/help-with-script-for-exporting-cover-art/45768/3 "2019-06-28T14:32:17Z")

</div>

That's a padding function, right? I thought about going that way, but the problem is that I've got an album with 10 discs, so padding to a single digit won't work.

(About %path%: I've found it in Mp3Tag's default fields, there's %path% and there's %\_directory%, not sure what's the difference, but since I won't need'em, whatever 🙂 )

---

<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:** [June 28, 2019, 2:53pm UTC](https://community.mp3tag.de/t/help-with-script-for-exporting-cover-art/45768/4 "2019-06-28T14:53:18Z")

</div>

> [@fabiorfreitas](#):
>
> That's a padding function, right

Yes, that plus it transforms any text into its numerical value, starting at the front.  
So it cuts away anything that is following a character that is not a number.  
1/2 will become just "1" as the slash is no numeric character.  
So 10 discs should come out just fine.  
The ",1" I added was to avoid padding with leading zeros.

> [@fabiorfreitas](#):
>
> About %path%: I've found it in Mp3Tag's default fields, there's %path%

No, it is still %\_path% with a leading underscore, see the help on MP3tag variables:

> **[Exporting Tag and File Information – Mp3tag Documentation](https://docs.mp3tag.de/export/)**
>
> Documentation on exporting tag and file information to text-based file formats. Mp3tag is the universal Tag Editor.

---

<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:** [July 28, 2019, 2:53pm UTC](https://community.mp3tag.de/t/help-with-script-for-exporting-cover-art/45768/5 "2019-07-28T14:53:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
