# String function prevents formatting \_DIRECTORY on multiple files

**URL:** https://community.mp3tag.de/t/string-function-prevents-formatting-directory-on-multiple-files/64890
**Category:** Fixed Bugs
**Tags:** bug-fixed
**Created:** [May 30, 2024, 5:57pm UTC](https://community.mp3tag.de/t/string-function-prevents-formatting-directory-on-multiple-files/64890 "2024-05-30T17:57:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Eincrou](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/ee59a6/32.png) [@Eincrou](https://community.mp3tag.de/u/Eincrou)
#### Post date: [May 30, 2024, 5:57pm UTC](https://community.mp3tag.de/t/string-function-prevents-formatting-directory-on-multiple-files/64890/1 "2024-05-30T17:57:55Z")

</div>

Thanks for updating Mp3Tag to 3.26. After updating, I noticed a change in behavior on an Action I use. First, I'll explain how I use it.

I have media files in separate folders. I want to rename the files, then move all of them to the parent directory. Each of the separate folders are eliminated.

```auto
G:\Folder A\Folder 1\song1.mp3
G:\Folder A\Folder 2\song2.mp3
G:\Folder A\Folder 3\song3.mp3

```

The Action:

```auto
Format value "_FILENAME": $validate(%album% - %title%$if($grtr($len(%artist%),0), - %artist%,),-)
Format value "_DIRECTORY": $validate($left(%_path%,$sub($sub($strrchr(%_path%,'\'),1), $len(%_directory%))),-)

```

Results in:

```auto
G:\Folder A\song1renamed.mp3 (using a basic filename here, to keep it simple)
G:\Folder A\song2renamed.mp3
G:\Folder A\song3renamed.mp3

```

To "move" the files to the parent folder, the Action modifies the `_DIRECTORY` information field. The command looks at the current directory of the file and ignores the last folder in the hierarchy. Doing this automatically "deletes" the folder, too.

This Action still works properly in v3.26, but it no longer runs on all selected files. After changing the filename and directory of the first selected item, it stops.

I tried to narrow it down by finding when "format value" stops working on multiple files.

Using the basic "Tag - Tag" converter, I discovered that simply using `$strrchr(%_path%,'\')` as a format string on the `_DIRECTORY` field prevents the operation from running on multiple selected files.

The Tag-Tag converter preview correctly shows the result of `$strrchr(%_path%,'\')` on all selected files. But when I apply, the directory is only changed on the first selected file.

If instead of formatting `_DIRECTORY`, I instead format `_FILENAME`, all selected files have their filenames changed to the value of `$strrchr(%_path%,'\')` The issue is specific to formatting \_DIRECTORY.

I'm using the 64-bit version of v3.26 on Windows 11.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [May 31, 2024, 7:37am UTC](https://community.mp3tag.de/t/string-function-prevents-formatting-directory-on-multiple-files/64890/3 "2024-05-31T07:37:05Z")

</div>

Thank you for reporting! It's quite tricky and I'll probably need the next week to fix it.

It's most likely not only the first selected file, but the all the files of the first renamed subfolder that are moved.

I'll keep you posted.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [June 11, 2024, 1:53pm UTC](https://community.mp3tag.de/t/string-function-prevents-formatting-directory-on-multiple-files/64890/4 "2024-06-11T13:53:55Z")

</div>

This should be fixed with [Mp3tag v3.26a](https://community.mp3tag.de/t/455).

---

<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 11, 2024, 1:54pm UTC](https://community.mp3tag.de/t/string-function-prevents-formatting-directory-on-multiple-files/64890/5 "2024-07-11T13:54:07Z")

</div>

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