[X] Windows, filename char validation, and the apostrophe: '

I originally ripped some songs on a mac, and am trying to consolidate my collection. But I'm doing it on Win7.

I used the $validate(,~), but there were several files that didn't rename because the apostrophe is illegal, but it wasn't changed to a tilde.

I can't create files on a portable drive (using exFAT) that has the collection since validate does not remove the single-quote/apostrophe - on US keyboards it is below the standard double-quote, i.e. "'", and I can't enter it into ANY of the string operations - I get syntax errors, and I haven't found any way to escape or substitute it. I can't even filter "all files containing an '".

e.g.

"Surely You're Joking" by Richard Feynman. I can't search for these and validate should change it to You~re.

Perhaps there is a way to enter apostrophes, but I've tried finding an answer and haven't come up with anything. If validate would simply add the apostrophe to the list of invalid characters it converted it would have worked and would fix this bug. But in general, since ' is valid in ID3 strings but not in any Windows fields or other string operators, the larger problem is to allow entering arbitrary characters maybe by hex or decimal value.

You can search/filter for the apostrophe with
"'"
double quote-apostrophe-double quote
to use the apostrophe e.g. in a $replace statement, use this
' '
apostrophe-blank-apostrophe

So you can append the $validate function with
$validate($replace(%_filename%,' ',~),~)

All these examples are laid down in the online help.

On DOS/Windows/FAT32/NTFS the apostrophe is a legal character (char ' hex 27 ASCII 39).
Therefore the function $validate has no need to replace the apostrophe with another character.

You may use the function $replace ...

$replace(%_filename%,'','~') $replace(%_filename%,$char(39),'~') $replace(%_filename%,$char(39),$char(126))

See also ...
http://en.wikipedia.org/wiki/Quotation_mark

DD.20140108.2247.CET

Thanks. Help brings up file:///C:/Program%20Files%20%28x86%29/Mp3tag/help/main_scripting.html in my browser.

I could not find the "'" trick on the filter page. If it is there, it is well hidden.

The script page says:

' Outputs raw text without parsing. This will output the contained string and ignore all reserved characters. If you want to output this character, please use ''.

The text could be clearer, something like
(apostrophe or single quote) ... If you need to use the apostrophe in a string, use apostrophe-space-apostrophe, i.e. ' '.

It is hard to see the space between the single quotes.

I could find no examples where it was used on either page.

A separate character usage page explaining these strange situations might also be helpful.

But again thanks for explaining it.

This doesn't work.

Instead of getting

"Surely You~re Joking"

I get

"Surely~You're~Joking"

I needed to use two apostrophes in a row, i.e. apostrophe-apostrophe without the space.

I got the replace working, and if I type the characters in manually in Explorer it works, but mp3tag gives:

$validate($replace(%artist%-%albumartist%-%album%-%title%,'',~),~)-$num(%disknumber%,2)-$num(%track%,2)-%_filename%

File "E:\mp3redo\4cf66ea50.mp3" cannot be renamed to "E:\mp3redo
Feynman--
Surely You~re Joking--00-00-4cf66ea50.mp3".
The filename, directory name, or volume label syntax is incorrect.

(the filenames are in one long string - no line breaks - in the dialog box showing the error, the bb is splitting at hyphens).

The smallest file with the problem is 14 meg, but I can send it somewhere if it would help (as it is copyrighted I don't want to post it).

If this statement

is an accurate copy then I would say that esp. the apostrophe-part is missing a blank.
$validate($replace(%artist%-%albumartist%-%album%-%title%,' ',~),~)-$num(%disknumber%,2)-$num(%track%,2)-%_filename%

should be better.
And still I do not see where the MP3tag bug should be.

The attached picture displays success, at least on my machine.
Maybe you are not allowed to change the filename?
Do you have enough rights to change the filename?
Do you are the owner of this file?

Maybe the Mp3tag application has no rights to change the filename?
Did you install Mp3tag in the right way?


DD.20130109.0949.CET


Maybe you are not allowed to change the filename? I could in Windows Explorer
Do you have enough rights to change the filename? Same - No UAC box, I could just edit the name
Do you are the owner of this file? yes - but it could be some exFAT anomaly
Maybe the Mp3tag application has no rights to change the filename? It changed the other thousand files.
Did you install Mp3tag in the right way? Using the installer with defaults? Is there another way

I'm reformatting the drive as NTFS and will try again. I've not had other obvious problems with exFAT before, but it is possible there is something incompatible with it.

Thanks for the help and sorry for the confusion.

It eventually worked. I shifted to NTFS, but that wasn't the whole problem.

I switched to doing paths instead of names.
album\artist\title\disk-track\x.mp3

One of the files apparently had some invisible but valid characters (the Feynman/Surely You're Joking). It converted correctly when I manually typed the visible characters, but not if I used the %macros%. There were several that ended with "..." (audiobooks) which apparently NTFS doesn't like (replace,'...',~~~), and '. . .',~ ~ ~) got those).

The second problem is apparently there is a total path length limit in Win7. Several of the files were collections so for something like Mahler, listed under artist the orchestra, conductor, chorus and other things so it ended up as several very long strings, so the output whole path length exceeded some limit (1024 bytes?). I found this when I tried manually copying a file into a not so deep but long path and got the "path too long" message.

Eventually got everything renamed by $left(x,64) for the title and artist.

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