Tag to Filename Conversion May Fail with Escaped Literal Brackets

We know that literal brackets must be escaped with apostrophes. I am using this format:

%artist% ['['%director%']' ](%year%) %title%[ (%vocalist%)]

This mask occasionally fails, with Mp3tag showing an error message: "The filename, directory name, or volume label syntax is incorrect". Roughly one out of ten of my M4a files will fail wth that message. But if I remove the section ['['%director%']' ] then even those files will convert normally. So I am confident that the files themselves are OK. Can anyone spot what is wrong with my syntax or explain why it fails only with a few files?

Could you show the preview of such a failing file?
(I just tried a similar mask, though with GENRE and COMPOSER instead of DIRECTOR and VOCALIST, and 96 files and none produced an error. So I assume it is a character in the name or something.)

Ohrenkino, here is a paste from Preview for two files that fail:

"E:\Music\DOWNLOADS\British Bands\TEST\Banking On The Weather - The Masqueraders (Savoy Hotel Orpheans) - Columbia CB 490.m4a" ->
"E:\Music\DOWNLOADS\British Bands\TEST\The Masqueraders [Carroll Gibbons] (1932) Banking on the Weather (Les Allen).m4a"

"E:\Music\DOWNLOADS\British Bands\TEST\What Makes You So Adorable - Savoy Hotel Orpheans - Columbia CB 469.m4a" ->
"E:\Music\DOWNLOADS\British Bands\TEST\The Savoy Hotel Orpheans [Carroll Gibbons] (1932) What Makes You So Adorable (Al Bowlly).m4a"

Tag-FilenameScreenShot

Tag-FilenameErrorMsg

Thanks for your interest!

This is the output from my preview:

"C:\Music\DOWNLOADS\British bands\TEST\Banking On The Weather - The Masqueraders (Savoy Hotel Orpheans) - Columbia CB 490.mp3" ->
"C:\Music\DOWNLOADS\British bands\TEST\The Savoy Hotel Orpheans [Carroll Gibbons] (1998) Banking on the Weather (Ambient).mp3"

"C:\Music\DOWNLOADS\British bands\TEST\What Makes You So Adorable - Savoy Hotel Orpheans - Columbia CB 469.mp3" ->
"C:\Music\DOWNLOADS\British bands\TEST\The Savoy Hotel Orpheans [Carroll Gibbons] (1998) What Makes You So Adorable  (Ambient).mp3"

So it works over here ...
As I used COMPOSER and GENRE (as said before) it could be that you have to check whether you have strange characters in the data, e.g. a line break or something like that.

1 Like

At first I was sceptical because, as I said earlier, removing the ['['%director%']' ] section allows the files to convert. So by your logic the bad character could only be in the %director% tags, which are simply names. So I cleared these names in the two test files. Then I carefully typed the same text back in and... the files converted! I recall pasting the director names from Comments tags and some invisible garbage must have crept in.

Thank you very much, ohrenkino!