# How do I delete only the first ' - ' (space-dash-space) if there are two of them in a filename?

**URL:** <https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136>\
**Category:** Support\
**Created:** [December 18, 2023, 6:57pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136 "2023-12-18T18:57:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaveM](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@DaveM](https://community.mp3tag.de/u/DaveM)\
**Post date:** [December 18, 2023, 6:57pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/1 "2023-12-18T18:57:14Z")

</div>

Hello all

I'd be very grateful if anyone could help me with this one !

I have a large directory of files which should have a filename format of **Artist - Title.wav**

The issue is, that where the Artist's name is more than one word (like Micheal Jackson, or Paul Hardcastle) the first word of the Artist's name (Michael, or Paul, in the example above) is followed by a ' - ' (space-dash-space) and then the rest of the Artist's name.

![image](https://community.mp3tag.de/uploads/default/original/2X/3/321c84955f4393d330b82793bfb45abef40c6825.png)

This is further complicated because after the hyphenated Artist's name, there is another ' - ' (space-dash-space) to separate the Title field that follows.

So, if two lots of ' - ' (space-dash-space) exist in a given filename, I want to delete the first one (separating the Artist's name), but not the second one (separating Artist and Title).

However if the Artist's name is only one word (like Sting), then I want to preserve the following ' - ' (space-dash-space) that separates the following Title.

I hope all of that makes sense !!  
I'd be very thankful if anyone has an answer to this.

---

<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:** [December 18, 2023, 7:00pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/2 "2023-12-18T19:00:52Z")

</div>

Try Convert\>Filename - Filename:  
Mask over old filename: %1 - %2 - %3  
Mask over nee filename: %1 %2 - %3

I see a couple of files that do not match the pattern - like the ones by the Nightcrawlers.  
These will not get treated and stay the same.

---

<div class="post-metadata">

**Author:** ![DaveM](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@DaveM](https://community.mp3tag.de/u/DaveM)\
**Post date:** [December 18, 2023, 7:30pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/3 "2023-12-18T19:30:51Z")

</div>

Thanks, I'll give it a go. Yep, the whole directory is in a bit of a mess !

---

<div class="post-metadata">

**Author:** ![DaveM](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@DaveM](https://community.mp3tag.de/u/DaveM)\
**Post date:** [December 18, 2023, 7:35pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/4 "2023-12-18T19:35:08Z")

</div>

Sadly, I got this :

![image](https://community.mp3tag.de/uploads/default/original/2X/6/626e808d30a35966fbe513aa8f065a3fa02bc459.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:** [December 18, 2023, 7:36pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/5 "2023-12-18T19:36:25Z")

</div>

Which converter did you use?  
Filename-Tag?  
Tag-Filename?  
or, as recommended: Filename-Filename?

---

<div class="post-metadata">

**Author:** ![DaveM](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@DaveM](https://community.mp3tag.de/u/DaveM)\
**Post date:** [December 18, 2023, 7:41pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/6 "2023-12-18T19:41:05Z")

</div>

'Filename - Filename' as you suggested.  
I think it's the ones that only have a single ' - ' are throwing the error

---

<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:** [December 18, 2023, 7:53pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/7 "2023-12-18T19:53:18Z")

</div>

You could try to limit the files to the ones with 2 hyphens and filter with:  
`%_filename% MATCHES ".*-.+-.*"`

---

<div class="post-metadata">

**Author:** ![DaveM](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@DaveM](https://community.mp3tag.de/u/DaveM)\
**Post date:** [December 18, 2023, 8:04pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/8 "2023-12-18T20:04:54Z")

</div>

That's a great help, thanks so much for your support 😀

---

<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:** [January 17, 2024, 8:04pm UTC](https://community.mp3tag.de/t/how-do-i-delete-only-the-first-space-dash-space-if-there-are-two-of-them-in-a-filename/63136/9 "2024-01-17T20:04:58Z")

</div>

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