Replace diacritics within folder names

I have succeeded in replacing diacritics within filenames, but is there a way to do the same with folder/subfolder names? Thanks.

Try an action of the type "Format value" for _DIRECTORY where you $replace(%_path%,....)

Thanks for your reply. I've tried with one character in bottom half below, but it's not working. The top half is the Action to replace diacritics in FILENAME. Any hints on what I've done wrong?

You know that you can test such an expression in Convert > Tag-Tag.
Perhaps you could try %_directory% instead of %_path% - even though this replaces only in the current directory. I am not sure if that is the scope that you want to manipulate or whether that is the whole path.

Thanks for the suggestion, $replace(%_path%,Æ,AE) works in Tag-Tag. Is there a way in this single command to have more than one "from" value to be replaced by that "to"?

For instance: ā\ă\ą all convert to a.

Please see the help on scripting functions. You can add (up to 32?) pairs in a single function call.

Have made some progress. The "Remove Diacritics From FILENAME" Action below works well. It started with someone else's work on the forum to which I added some missing characters. The "Remove Diacritics From DIRECTORY" Action does NOT yet work. Any suggestions with regard to the latter are welcome. Thanks.

Remove Diacritics From DIRECTORY.mta (3.8 KB) Remove Diacritics From FILENAME.mta (9.2 KB)

As I said: you can test your expressions in Convert>Tag-Tag. So I would check there where and what the problem is.
Also, it would be nice if you could describe what does not yet work.

When testing with Tag-Tag, this replace works:
_DIRECTORY
$replace(%_path%,À,A,Á,A,Â,A,Ã,A,Ä,A,Å,A,Ā,A,Ă,A,Ą,A)

But this one does not:
_DIRECTORY
$replace(%_path%,\u00c0,A,\u00c1,A,\u00c2,A,\u00c3,A,\u00c4,A,\u00c5,A,\u0100,A,\u0102,A,\u0104,A)

Yet, when you input the first into an Mp3tag Action it saves it as the second. If I edit the MTA file that Mp3tag creates for this Action and replace the second with the first, that does not work either. By "not work" I mean that the characters are not replaced. Thanks again.

So I would note these things:
editing mta files directly with a text editor is apparently no good idea.
The $replace() function needs printable characters and no character codes.

This is where both of you went in the wrong direction. %_path% always contains the complete file path and setting this to _DIRECTORY makes no sense.

_DIRECTORY refers to the folder name in which the file is located and you can use $replace(%_directory%,...) to replace the diacritics within this parent folder name of the file.

If you need to address the whole folder path of the file, $replace(%_folderpath%,...) should work too (although, that's more of an undocumented feature).

Thank you both. $replace(%_folderpath%,...) does work, but it does not change the filename itself. Is there a way to include the filename, or can this Action call out to another Action (the "Remove from FILENAME" one)?

Finally, how would I incorporate this into the standard "Tag - Filename" Action that I use all the time? I'd like it to just be my "standard" way of doing this.

I think that as you have several steps that manipulate the filename, I would suggest that you

  • construct a filename in a user-defined field e.g. my_filename
  • treat the contents of this field (my_filename) with all the actions to smoothe the characters
  • use the finalized string from my_filename to write the real _FILENAME as with Tag-Filename
  • delete the user-defined field my_filename

The attached Action replaces diacritics in filename and folder names. Feel free to use if you need. If you discover any missing characters, please post back here. Thanks.

Replace PATH Diacritics.mta (8.0 KB)

P.S. Here is another way of accomplishing this:

This became a problem for me when one of my mobile apps would not properly handle files with these characters. Diacritics in the tags were ok, but not in the file system.