# (mac) Creating directories when tag fields include " / " characters

**URL:** https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527
**Category:** Mac
**Created:** [January 23, 2024, 7:41am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527 "2024-01-23T07:41:53Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![ankurbelnkrank](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@ankurbelnkrank](https://community.mp3tag.de/u/ankurbelnkrank)
#### Post date: [January 23, 2024, 7:41am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/1 "2024-01-23T07:41:53Z")

</div>

I'd like to sort all of my directories (currently formatted \< '['%catalognumber%']' %albumartist% - %album%\>) into a few directories based on the value of the %physicalmedia% tags I've given them (vinyl, CD, cassette). In attempting to do this; I ran the following action group:

field: \_DIRECTORY  
string: %physical media% / '['%catalognumber%']' %albumartist% - %album%

This worked great for about 3/8ths of the albums. The other 5/8ths in one way or another had a "/" character in one of the tag fields. Causing a new subdirectory to get created wherever the command encountered a "/".

Let me just put it very, very lightly when I say that undoing this error to a collection of 3164 directories was not, in any way, shape, or form, in any reality, dimension, galaxy, afterlife, what would be considered "fun" so on that note; how do I do this without ever having to undo that problematic outcome 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: [January 23, 2024, 7:48am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/2 "2024-01-23T07:48:00Z")

</div>

Enclose the fields in which you suspect a `/` to be present with  
`$replace(%fieldname%,/,_)`  
to replace the slash with an underscore.

If you use an abolute path you could move the current (extra) folder to its intended level without manually renaming files or folders.

---

<div class="post-metadata">

### Author: ![ankurbelnkrank](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@ankurbelnkrank](https://community.mp3tag.de/u/ankurbelnkrank)
#### Post date: [January 23, 2024, 8:21am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/3 "2024-01-23T08:21:04Z")

</div>

I mean it could be anything; in the catalog number, in the album artist (any album that's a split or collaboration might have a slash in the name), any double album or b/w single... I'm kind of confused about what I'm supposed to do with this.

What would the string look like, if my absolute path look something like...

/Volumes/EHD1/MusicArchive/\<\<%xxx%\>\>

---

<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: [January 23, 2024, 8:43am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/4 "2024-01-23T08:43:24Z")

</div>

> [@ankurbelnkrank](#):
>
> /Volumes/EHD1/MusicArchive/\<\<%xxx%\>\>

If you really only have the %xxx% as field reference, then it would be:  
`Volumes/EHD1/MusicArchive/$replace(%xxx%,/,_)`

If the %xxx% is more like

> [@ankurbelnkrank](#):
>
> string: %physical media% / '['%catalognumber%']' %albumartist% - %album%

Then the string could look like:  
String: `Volumes/EHD1/MusicArchive/%physical media% /'['$replace(%catalognumber%,/,_)']' $replace( %albumartist% - %album%,/,_)`

---

<div class="post-metadata">

### Author: ![ankurbelnkrank](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@ankurbelnkrank](https://community.mp3tag.de/u/ankurbelnkrank)
#### Post date: [January 23, 2024, 9:34am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/5 "2024-01-23T09:34:43Z")

</div>

\<\<%xxx%\>\> was placeholder for anything, lemme try out this string tho

---

<div class="post-metadata">

### Author: ![ankurbelnkrank](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@ankurbelnkrank](https://community.mp3tag.de/u/ankurbelnkrank)
#### Post date: [January 23, 2024, 9:40am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/6 "2024-01-23T09:40:03Z")

</div>

Can you help me backpedal through whats happening here when I try to paste that string in:

 ![Screenshot 2024-01-23 at 3.39.09 AM](https://community.mp3tag.de/uploads/default/original/3X/1/b/1bafe79ee864b6f561de7a95b5a9465ac49108ed.png)

---

<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: [January 23, 2024, 9:45am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/7 "2024-01-23T09:45:25Z")

</div>

I think that the definition for catlognumber is not quite correct - $replace() should contain a slash instead of a space.

---

<div class="post-metadata">

### Author: ![ankurbelnkrank](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@ankurbelnkrank](https://community.mp3tag.de/u/ankurbelnkrank)
#### Post date: [January 23, 2024, 9:51am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/8 "2024-01-23T09:51:12Z")

</div>

![Screenshot 2024-01-23 at 3.50.02 AM](https://community.mp3tag.de/uploads/default/original/3X/f/b/fbbbc4fe11b2667f19ff2e9a9839f9b6d2470a42.png)

I have it looking like this now; however when I execute the string, nothing happens.

---

<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: [January 23, 2024, 9:53am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/9 "2024-01-23T09:53:11Z")

</div>

You could check out every part of the expression in the preview of Convert\>Tag-Filename. and then see what the result of each part would be. Do not execute the converter, just have a look at the preview.

---

<div class="post-metadata">

### Author: ![ankurbelnkrank](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@ankurbelnkrank](https://community.mp3tag.de/u/ankurbelnkrank)
#### Post date: [January 23, 2024, 9:53am UTC](https://community.mp3tag.de/t/mac-creating-directories-when-tag-fields-include-characters/63527/10 "2024-01-23T09:53:34Z")

</div>

WAIT there's a " instead on an ', think we got it here
