# Tag mp3 from file path

**URL:** https://community.mp3tag.de/t/tag-mp3-from-file-path/6275
**Category:** Support
**Created:** [February 17, 2008, 1:45pm UTC](https://community.mp3tag.de/t/tag-mp3-from-file-path/6275 "2008-02-17T13:45:39Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Kirkski](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/e95f7d/32.png) [@Kirkski](https://community.mp3tag.de/u/Kirkski)
#### Post date: [February 17, 2008, 1:45pm UTC](https://community.mp3tag.de/t/tag-mp3-from-file-path/6275/1 "2008-02-17T13:45:39Z")

</div>

Hello all,

I'm sure there's a logical way to do this but i can't figure it out.

I've tagged all my mp3 based on the solution found in  
[/t/5621/1](https://community.mp3tag.de/t/5621/1)

For example %Artist%\%Album%\%Title% tagged the file "C:\David Bowie\Ziggy Stardust\track1.mp3" ...

Artist: David Bowie  
Album: Ziggy Stardust  
Track:Track1

However, (as you'd expect) the path "C:\David Bowie\Platinum Collection\cd3\track1.mp3" tags Track1.mp3 ...

Artist: Platinum Collection  
Album: CD3  
Track:Track1

Are there any RegExp heads out there that know how to tag the below file in the format detailed below?

Path:  
C:\David Bowie\Platinum Collection\cd3\track1.mp3

Artist: David Bowie  
Album: Platinum Collection - CD3  
Track:Track1

Thanks in advance.

---

<div class="post-metadata">

### Author: ![mjcm](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@mjcm](https://community.mp3tag.de/u/mjcm)
#### Post date: [February 17, 2008, 2:15pm UTC](https://community.mp3tag.de/t/tag-mp3-from-file-path/6275/2 "2008-02-17T14:15:10Z")

</div>

Hi,

Does %artist%\%album%\CD%discnumber%\%title% help? But this needs the extended Tag discnumber to be filled in. (You get Extended Tags by pressing ALT - T or via View - Extended Tags

Regards  
Michael

---

<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: [February 17, 2008, 2:51pm UTC](https://community.mp3tag.de/t/tag-mp3-from-file-path/6275/3 "2008-02-17T14:51:49Z")

</div>

> [@Kirkski](#):
>
> ... Are there any RegExp heads out there that know how to tag the below file in the format detailed below?  
> Path:  
> C:\David Bowie\Platinum Collection\cd3\track1.mp3
> 
> Artist: David Bowie  
> Album: Platinum Collection - CD3  
> Track:Track1  
> ...

You may try:

```
%Artist%\$regexp(%Album%,^(.+) - (CD\d+)$,$1)\$lower($regexp(%Album%,^(.+) - (CD\d+)$,$2))\\%Title%

```

DD.20080217.1651.CET

---

<div class="post-metadata">

### Author: ![Kirkski](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/e95f7d/32.png) [@Kirkski](https://community.mp3tag.de/u/Kirkski)
#### Post date: [February 17, 2008, 3:21pm UTC](https://community.mp3tag.de/t/tag-mp3-from-file-path/6275/4 "2008-02-17T15:21:11Z")

</div>

Ok,

I've tried the first solution using the discnumber tag. It almost meets my requirements, the only thing that's missing is the numbering on the album tag. For example:

Album: Platinum Collection  
Not  
Album: Platinum Collection - CD3

Thanks Mike\_nl.

The second solution returns the following:

Artist: C:  
Title: track1

DetlevD, Have you missed something in your RegExp?

Thanks (again) in advance.

---

<div class="post-metadata">

### Author: ![mjcm](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/9d8465/32.png) [@mjcm](https://community.mp3tag.de/u/mjcm)
#### Post date: [February 17, 2008, 3:46pm UTC](https://community.mp3tag.de/t/tag-mp3-from-file-path/6275/5 "2008-02-17T15:46:42Z")

</div>

Hi,

then I think

%artist%\%album% CD %Discnumber%\%title%

Must work

Regards  
Michael

---

<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: [February 17, 2008, 5:44pm UTC](https://community.mp3tag.de/t/tag-mp3-from-file-path/6275/6 "2008-02-17T17:44:36Z")

</div>

> [@Kirkski](#):
>
> ... The second solution returns the following:  
> Artist: C:  
> Title: track1
> 
> DetlevD, Have you missed something in your RegExp? ...

Hmm, I thought you have a tagfield named ALBUM which contains for example such a string like 'Platinum Collection - CD3', that means, this string has two parts connected by a space-hyphen-space sequence, so that:  
'$regexp(%Album%,^(.+) - (CD\d+)$,$1)$lower($regexp(%Album%,^(.+) - (CD\d+)$,$2))'  
will result in:  
'Platinum Collection\cd3'.  
This case has been prooved to be correct.

DD.20080217.1944.CET

Hmm ... I did misunderstand OP Kirkski request and proposed a format string on the base of already proper filled tag-fields, but the OP wanted to split the filepath into its components to be stored in the tag-fields, with the special need to combine some splitted values into one tag-field, just in one process.

User Mike\_nl in post #2 gave the solution to fill the path component "CD number" into the tag-Field DISCNUMBER.  
That is the right way.

In a following step both values from the ALBUM tag-field and from the DISCNUMBER tag-field can be combined into the ALBUM tag-field.  
Action: Format value  
Field: ALBUM  
Formatstring: %ALBUM%' - CD'%DISCNUMBER%

DD.20111109.0816.CET

---

<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:20pm UTC](https://community.mp3tag.de/t/tag-mp3-from-file-path/6275/7 "2026-02-09T12:20:47Z")

</div>


